blob: b4758a734122e7e3242b3f80b80690e634e41ad0 [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 \
Victor Stinner259f0e42017-01-17 01:35:17 +010014 {"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_FASTCALL, pyexpat_xmlparser_Parse__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030015
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 *
Victor Stinner259f0e42017-01-17 01:35:17 +010021pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030022{
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
Sylvain74453812017-06-10 06:51:48 +020027 if (!_PyArg_NoStackKeywords("Parse", kwnames)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030028 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030029 }
Victor Stinner259f0e42017-01-17 01:35:17 +010030
Sylvain74453812017-06-10 06:51:48 +020031 if (!_PyArg_ParseStack(args, nargs, "O|i:Parse",
32 &data, &isfinal)) {
Victor Stinner259f0e42017-01-17 01:35:17 +010033 goto exit;
34 }
Serhiy Storchaka8b2e8b62015-05-30 11:30:39 +030035 return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030036
37exit:
38 return return_value;
39}
40
41PyDoc_STRVAR(pyexpat_xmlparser_ParseFile__doc__,
42"ParseFile($self, file, /)\n"
43"--\n"
44"\n"
45"Parse XML data from file-like object.");
46
47#define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF \
48 {"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
49
50PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
51"SetBase($self, base, /)\n"
52"--\n"
53"\n"
54"Set the base URL for the parser.");
55
56#define PYEXPAT_XMLPARSER_SETBASE_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +030057 {"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_O, pyexpat_xmlparser_SetBase__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030058
59static PyObject *
60pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base);
61
62static PyObject *
Serhiy Storchaka92e8af62015-04-04 00:12:11 +030063pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030064{
65 PyObject *return_value = NULL;
66 const char *base;
67
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030068 if (!PyArg_Parse(arg, "s:SetBase", &base)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030069 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030070 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030071 return_value = pyexpat_xmlparser_SetBase_impl(self, base);
72
73exit:
74 return return_value;
75}
76
77PyDoc_STRVAR(pyexpat_xmlparser_GetBase__doc__,
78"GetBase($self, /)\n"
79"--\n"
80"\n"
81"Return base URL string for the parser.");
82
83#define PYEXPAT_XMLPARSER_GETBASE_METHODDEF \
84 {"GetBase", (PyCFunction)pyexpat_xmlparser_GetBase, METH_NOARGS, pyexpat_xmlparser_GetBase__doc__},
85
86static PyObject *
87pyexpat_xmlparser_GetBase_impl(xmlparseobject *self);
88
89static PyObject *
90pyexpat_xmlparser_GetBase(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
91{
92 return pyexpat_xmlparser_GetBase_impl(self);
93}
94
95PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
96"GetInputContext($self, /)\n"
97"--\n"
98"\n"
99"Return the untranslated text of the input that caused the current event.\n"
100"\n"
101"If the event was generated by a large amount of text (such as a start tag\n"
102"for an element with many attributes), not all of the text may be available.");
103
104#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
105 {"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
106
107static PyObject *
108pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self);
109
110static PyObject *
111pyexpat_xmlparser_GetInputContext(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
112{
113 return pyexpat_xmlparser_GetInputContext_impl(self);
114}
115
116PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
117"ExternalEntityParserCreate($self, context, encoding=None, /)\n"
118"--\n"
119"\n"
120"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
121
122#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
Victor Stinner259f0e42017-01-17 01:35:17 +0100123 {"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_FASTCALL, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300124
125static PyObject *
Larry Hastings89964c42015-04-14 18:07:59 -0400126pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
127 const char *context,
128 const char *encoding);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300129
130static PyObject *
Victor Stinner259f0e42017-01-17 01:35:17 +0100131pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300132{
133 PyObject *return_value = NULL;
134 const char *context;
135 const char *encoding = NULL;
136
Sylvain74453812017-06-10 06:51:48 +0200137 if (!_PyArg_NoStackKeywords("ExternalEntityParserCreate", kwnames)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300138 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300139 }
Victor Stinner259f0e42017-01-17 01:35:17 +0100140
Sylvain74453812017-06-10 06:51:48 +0200141 if (!_PyArg_ParseStack(args, nargs, "z|s:ExternalEntityParserCreate",
142 &context, &encoding)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100143 goto exit;
144 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300145 return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
146
147exit:
148 return return_value;
149}
150
151PyDoc_STRVAR(pyexpat_xmlparser_SetParamEntityParsing__doc__,
152"SetParamEntityParsing($self, flag, /)\n"
153"--\n"
154"\n"
155"Controls parsing of parameter entities (including the external DTD subset).\n"
156"\n"
157"Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n"
158"XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n"
159"XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n"
160"was successful.");
161
162#define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300163 {"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_O, pyexpat_xmlparser_SetParamEntityParsing__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300164
165static PyObject *
166pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag);
167
168static PyObject *
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300169pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300170{
171 PyObject *return_value = NULL;
172 int flag;
173
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300174 if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300175 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300176 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300177 return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
178
179exit:
180 return return_value;
181}
182
183#if (XML_COMBINED_VERSION >= 19505)
184
185PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
186"UseForeignDTD($self, flag=True, /)\n"
187"--\n"
188"\n"
189"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
190"\n"
191"This readily allows the use of a \'default\' document type controlled by the\n"
192"application, while still getting the advantage of providing document type\n"
193"information to the parser. \'flag\' defaults to True if not provided.");
194
195#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
Victor Stinner259f0e42017-01-17 01:35:17 +0100196 {"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_FASTCALL, pyexpat_xmlparser_UseForeignDTD__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300197
198static PyObject *
199pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
200
201static PyObject *
Victor Stinner259f0e42017-01-17 01:35:17 +0100202pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300203{
204 PyObject *return_value = NULL;
205 int flag = 1;
206
Sylvain74453812017-06-10 06:51:48 +0200207 if (!_PyArg_NoStackKeywords("UseForeignDTD", kwnames)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300208 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300209 }
Victor Stinner259f0e42017-01-17 01:35:17 +0100210
Sylvain74453812017-06-10 06:51:48 +0200211 if (!_PyArg_ParseStack(args, nargs, "|p:UseForeignDTD",
212 &flag)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100213 goto exit;
214 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300215 return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
216
217exit:
218 return return_value;
219}
220
221#endif /* (XML_COMBINED_VERSION >= 19505) */
222
223PyDoc_STRVAR(pyexpat_xmlparser___dir____doc__,
224"__dir__($self, /)\n"
Zachary Ware8ef887c2015-04-13 18:22:35 -0500225"--\n"
226"\n");
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300227
228#define PYEXPAT_XMLPARSER___DIR___METHODDEF \
229 {"__dir__", (PyCFunction)pyexpat_xmlparser___dir__, METH_NOARGS, pyexpat_xmlparser___dir____doc__},
230
231static PyObject *
232pyexpat_xmlparser___dir___impl(xmlparseobject *self);
233
234static PyObject *
235pyexpat_xmlparser___dir__(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
236{
237 return pyexpat_xmlparser___dir___impl(self);
238}
239
240PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
241"ParserCreate($module, /, encoding=None, namespace_separator=None,\n"
242" intern=None)\n"
243"--\n"
244"\n"
245"Return a new XML parser object.");
246
247#define PYEXPAT_PARSERCREATE_METHODDEF \
Victor Stinner37e4ef72016-09-09 20:00:13 -0700248 {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_FASTCALL, pyexpat_ParserCreate__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300249
250static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300251pyexpat_ParserCreate_impl(PyObject *module, const char *encoding,
Larry Hastings89964c42015-04-14 18:07:59 -0400252 const char *namespace_separator, PyObject *intern);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300253
254static PyObject *
Victor Stinner37e4ef72016-09-09 20:00:13 -0700255pyexpat_ParserCreate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300256{
257 PyObject *return_value = NULL;
Serhiy Storchaka9171a8b2016-08-14 10:52:18 +0300258 static const char * const _keywords[] = {"encoding", "namespace_separator", "intern", NULL};
259 static _PyArg_Parser _parser = {"|zzO:ParserCreate", _keywords, 0};
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300260 const char *encoding = NULL;
261 const char *namespace_separator = NULL;
262 PyObject *intern = NULL;
263
Victor Stinner3e1fad62017-01-17 01:29:01 +0100264 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300265 &encoding, &namespace_separator, &intern)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300266 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300267 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300268 return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
269
270exit:
271 return return_value;
272}
273
274PyDoc_STRVAR(pyexpat_ErrorString__doc__,
275"ErrorString($module, code, /)\n"
276"--\n"
277"\n"
278"Returns string error for given number.");
279
280#define PYEXPAT_ERRORSTRING_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300281 {"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_O, pyexpat_ErrorString__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300282
283static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300284pyexpat_ErrorString_impl(PyObject *module, long code);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300285
286static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300287pyexpat_ErrorString(PyObject *module, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300288{
289 PyObject *return_value = NULL;
290 long code;
291
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300292 if (!PyArg_Parse(arg, "l:ErrorString", &code)) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300293 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +0300294 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300295 return_value = pyexpat_ErrorString_impl(module, code);
296
297exit:
298 return return_value;
299}
300
301#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
302 #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
303#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
Sylvain74453812017-06-10 06:51:48 +0200304/*[clinic end generated code: output=a51f9d31aff1a757 input=a9049054013a1b77]*/