blob: 75a096cdff0154bec5160be2096dd1899409b2f8 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__,
Serhiy Storchaka8b2e8b62015-05-30 11:30:39 +03006"Parse($self, data, isfinal=False, /)\n"
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03007"--\n"
8"\n"
9"Parse XML data.\n"
10"\n"
11"`isfinal\' should be true at end of input.");
12
13#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
14 {"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_VARARGS, pyexpat_xmlparser_Parse__doc__},
15
16static PyObject *
Larry Hastings89964c42015-04-14 18:07:59 -040017pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
Serhiy Storchaka8b2e8b62015-05-30 11:30:39 +030018 int isfinal);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030019
20static PyObject *
21pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args)
22{
23 PyObject *return_value = NULL;
24 PyObject *data;
Serhiy Storchaka8b2e8b62015-05-30 11:30:39 +030025 int isfinal = 0;
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030026
Serhiy Storchaka247789c2015-04-24 00:40:51 +030027 if (!PyArg_ParseTuple(args, "O|i:Parse",
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030028 &data, &isfinal)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030029 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030030 }
Serhiy Storchaka8b2e8b62015-05-30 11:30:39 +030031 return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030032
33exit:
34 return return_value;
35}
36
37PyDoc_STRVAR(pyexpat_xmlparser_ParseFile__doc__,
38"ParseFile($self, file, /)\n"
39"--\n"
40"\n"
41"Parse XML data from file-like object.");
42
43#define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF \
44 {"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
45
46PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
47"SetBase($self, base, /)\n"
48"--\n"
49"\n"
50"Set the base URL for the parser.");
51
52#define PYEXPAT_XMLPARSER_SETBASE_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +030053 {"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_O, pyexpat_xmlparser_SetBase__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030054
55static PyObject *
56pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base);
57
58static PyObject *
Serhiy Storchaka92e8af62015-04-04 00:12:11 +030059pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030060{
61 PyObject *return_value = NULL;
62 const char *base;
63
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030064 if (!PyArg_Parse(arg, "s:SetBase", &base)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030065 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030066 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030067 return_value = pyexpat_xmlparser_SetBase_impl(self, base);
68
69exit:
70 return return_value;
71}
72
73PyDoc_STRVAR(pyexpat_xmlparser_GetBase__doc__,
74"GetBase($self, /)\n"
75"--\n"
76"\n"
77"Return base URL string for the parser.");
78
79#define PYEXPAT_XMLPARSER_GETBASE_METHODDEF \
80 {"GetBase", (PyCFunction)pyexpat_xmlparser_GetBase, METH_NOARGS, pyexpat_xmlparser_GetBase__doc__},
81
82static PyObject *
83pyexpat_xmlparser_GetBase_impl(xmlparseobject *self);
84
85static PyObject *
86pyexpat_xmlparser_GetBase(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
87{
88 return pyexpat_xmlparser_GetBase_impl(self);
89}
90
91PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
92"GetInputContext($self, /)\n"
93"--\n"
94"\n"
95"Return the untranslated text of the input that caused the current event.\n"
96"\n"
97"If the event was generated by a large amount of text (such as a start tag\n"
98"for an element with many attributes), not all of the text may be available.");
99
100#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
101 {"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
102
103static PyObject *
104pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self);
105
106static PyObject *
107pyexpat_xmlparser_GetInputContext(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
108{
109 return pyexpat_xmlparser_GetInputContext_impl(self);
110}
111
112PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
113"ExternalEntityParserCreate($self, context, encoding=None, /)\n"
114"--\n"
115"\n"
116"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
117
118#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
119 {"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
120
121static PyObject *
Larry Hastings89964c42015-04-14 18:07:59 -0400122pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
123 const char *context,
124 const char *encoding);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300125
126static PyObject *
127pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
128{
129 PyObject *return_value = NULL;
130 const char *context;
131 const char *encoding = NULL;
132
Serhiy Storchaka247789c2015-04-24 00:40:51 +0300133 if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate",
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300134 &context, &encoding)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300135 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300136 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300137 return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
138
139exit:
140 return return_value;
141}
142
143PyDoc_STRVAR(pyexpat_xmlparser_SetParamEntityParsing__doc__,
144"SetParamEntityParsing($self, flag, /)\n"
145"--\n"
146"\n"
147"Controls parsing of parameter entities (including the external DTD subset).\n"
148"\n"
149"Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n"
150"XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n"
151"XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n"
152"was successful.");
153
154#define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300155 {"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_O, pyexpat_xmlparser_SetParamEntityParsing__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300156
157static PyObject *
158pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag);
159
160static PyObject *
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300161pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300162{
163 PyObject *return_value = NULL;
164 int flag;
165
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300166 if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300167 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300168 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300169 return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
170
171exit:
172 return return_value;
173}
174
175#if (XML_COMBINED_VERSION >= 19505)
176
177PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
178"UseForeignDTD($self, flag=True, /)\n"
179"--\n"
180"\n"
181"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
182"\n"
183"This readily allows the use of a \'default\' document type controlled by the\n"
184"application, while still getting the advantage of providing document type\n"
185"information to the parser. \'flag\' defaults to True if not provided.");
186
187#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
188 {"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__},
189
190static PyObject *
191pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
192
193static PyObject *
194pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
195{
196 PyObject *return_value = NULL;
197 int flag = 1;
198
Serhiy Storchaka247789c2015-04-24 00:40:51 +0300199 if (!PyArg_ParseTuple(args, "|p:UseForeignDTD",
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300200 &flag)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300201 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300202 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300203 return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
204
205exit:
206 return return_value;
207}
208
209#endif /* (XML_COMBINED_VERSION >= 19505) */
210
211PyDoc_STRVAR(pyexpat_xmlparser___dir____doc__,
212"__dir__($self, /)\n"
Zachary Ware8ef887c2015-04-13 18:22:35 -0500213"--\n"
214"\n");
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300215
216#define PYEXPAT_XMLPARSER___DIR___METHODDEF \
217 {"__dir__", (PyCFunction)pyexpat_xmlparser___dir__, METH_NOARGS, pyexpat_xmlparser___dir____doc__},
218
219static PyObject *
220pyexpat_xmlparser___dir___impl(xmlparseobject *self);
221
222static PyObject *
223pyexpat_xmlparser___dir__(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
224{
225 return pyexpat_xmlparser___dir___impl(self);
226}
227
228PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
229"ParserCreate($module, /, encoding=None, namespace_separator=None,\n"
230" intern=None)\n"
231"--\n"
232"\n"
233"Return a new XML parser object.");
234
235#define PYEXPAT_PARSERCREATE_METHODDEF \
Victor Stinner37e4ef72016-09-09 20:00:13 -0700236 {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_FASTCALL, pyexpat_ParserCreate__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300237
238static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300239pyexpat_ParserCreate_impl(PyObject *module, const char *encoding,
Larry Hastings89964c42015-04-14 18:07:59 -0400240 const char *namespace_separator, PyObject *intern);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300241
242static PyObject *
Victor Stinner37e4ef72016-09-09 20:00:13 -0700243pyexpat_ParserCreate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300244{
245 PyObject *return_value = NULL;
Serhiy Storchaka9171a8b2016-08-14 10:52:18 +0300246 static const char * const _keywords[] = {"encoding", "namespace_separator", "intern", NULL};
247 static _PyArg_Parser _parser = {"|zzO:ParserCreate", _keywords, 0};
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300248 const char *encoding = NULL;
249 const char *namespace_separator = NULL;
250 PyObject *intern = NULL;
251
Victor Stinner37e4ef72016-09-09 20:00:13 -0700252 if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300253 &encoding, &namespace_separator, &intern)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300254 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300255 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300256 return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
257
258exit:
259 return return_value;
260}
261
262PyDoc_STRVAR(pyexpat_ErrorString__doc__,
263"ErrorString($module, code, /)\n"
264"--\n"
265"\n"
266"Returns string error for given number.");
267
268#define PYEXPAT_ERRORSTRING_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300269 {"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_O, pyexpat_ErrorString__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300270
271static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300272pyexpat_ErrorString_impl(PyObject *module, long code);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300273
274static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300275pyexpat_ErrorString(PyObject *module, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300276{
277 PyObject *return_value = NULL;
278 long code;
279
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300280 if (!PyArg_Parse(arg, "l:ErrorString", &code)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300281 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300282 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300283 return_value = pyexpat_ErrorString_impl(module, code);
284
285exit:
286 return return_value;
287}
288
289#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
290 #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
291#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
Victor Stinner37e4ef72016-09-09 20:00:13 -0700292/*[clinic end generated code: output=e889f7c6af6cc42f input=a9049054013a1b77]*/