blob: c5b5c71c995c1c3f217d111826ff2c835643919f [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 Storchaka8b2e8b62015-05-30 11:30:39 +030028 &data, &isfinal))
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030029 goto exit;
Serhiy Storchaka8b2e8b62015-05-30 11:30:39 +030030 return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030031
32exit:
33 return return_value;
34}
35
36PyDoc_STRVAR(pyexpat_xmlparser_ParseFile__doc__,
37"ParseFile($self, file, /)\n"
38"--\n"
39"\n"
40"Parse XML data from file-like object.");
41
42#define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF \
43 {"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
44
45PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
46"SetBase($self, base, /)\n"
47"--\n"
48"\n"
49"Set the base URL for the parser.");
50
51#define PYEXPAT_XMLPARSER_SETBASE_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +030052 {"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_O, pyexpat_xmlparser_SetBase__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030053
54static PyObject *
55pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base);
56
57static PyObject *
Serhiy Storchaka92e8af62015-04-04 00:12:11 +030058pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030059{
60 PyObject *return_value = NULL;
61 const char *base;
62
Serhiy Storchaka247789c2015-04-24 00:40:51 +030063 if (!PyArg_Parse(arg, "s:SetBase", &base))
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030064 goto exit;
65 return_value = pyexpat_xmlparser_SetBase_impl(self, base);
66
67exit:
68 return return_value;
69}
70
71PyDoc_STRVAR(pyexpat_xmlparser_GetBase__doc__,
72"GetBase($self, /)\n"
73"--\n"
74"\n"
75"Return base URL string for the parser.");
76
77#define PYEXPAT_XMLPARSER_GETBASE_METHODDEF \
78 {"GetBase", (PyCFunction)pyexpat_xmlparser_GetBase, METH_NOARGS, pyexpat_xmlparser_GetBase__doc__},
79
80static PyObject *
81pyexpat_xmlparser_GetBase_impl(xmlparseobject *self);
82
83static PyObject *
84pyexpat_xmlparser_GetBase(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
85{
86 return pyexpat_xmlparser_GetBase_impl(self);
87}
88
89PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
90"GetInputContext($self, /)\n"
91"--\n"
92"\n"
93"Return the untranslated text of the input that caused the current event.\n"
94"\n"
95"If the event was generated by a large amount of text (such as a start tag\n"
96"for an element with many attributes), not all of the text may be available.");
97
98#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
99 {"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
100
101static PyObject *
102pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self);
103
104static PyObject *
105pyexpat_xmlparser_GetInputContext(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
106{
107 return pyexpat_xmlparser_GetInputContext_impl(self);
108}
109
110PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
111"ExternalEntityParserCreate($self, context, encoding=None, /)\n"
112"--\n"
113"\n"
114"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
115
116#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
117 {"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
118
119static PyObject *
Larry Hastings89964c42015-04-14 18:07:59 -0400120pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
121 const char *context,
122 const char *encoding);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300123
124static PyObject *
125pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
126{
127 PyObject *return_value = NULL;
128 const char *context;
129 const char *encoding = NULL;
130
Serhiy Storchaka247789c2015-04-24 00:40:51 +0300131 if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate",
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300132 &context, &encoding))
133 goto exit;
134 return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
135
136exit:
137 return return_value;
138}
139
140PyDoc_STRVAR(pyexpat_xmlparser_SetParamEntityParsing__doc__,
141"SetParamEntityParsing($self, flag, /)\n"
142"--\n"
143"\n"
144"Controls parsing of parameter entities (including the external DTD subset).\n"
145"\n"
146"Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n"
147"XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n"
148"XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n"
149"was successful.");
150
151#define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300152 {"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_O, pyexpat_xmlparser_SetParamEntityParsing__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300153
154static PyObject *
155pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag);
156
157static PyObject *
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300158pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300159{
160 PyObject *return_value = NULL;
161 int flag;
162
Serhiy Storchaka247789c2015-04-24 00:40:51 +0300163 if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag))
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300164 goto exit;
165 return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
166
167exit:
168 return return_value;
169}
170
171#if (XML_COMBINED_VERSION >= 19505)
172
173PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
174"UseForeignDTD($self, flag=True, /)\n"
175"--\n"
176"\n"
177"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
178"\n"
179"This readily allows the use of a \'default\' document type controlled by the\n"
180"application, while still getting the advantage of providing document type\n"
181"information to the parser. \'flag\' defaults to True if not provided.");
182
183#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
184 {"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__},
185
186static PyObject *
187pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
188
189static PyObject *
190pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
191{
192 PyObject *return_value = NULL;
193 int flag = 1;
194
Serhiy Storchaka247789c2015-04-24 00:40:51 +0300195 if (!PyArg_ParseTuple(args, "|p:UseForeignDTD",
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300196 &flag))
197 goto exit;
198 return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
199
200exit:
201 return return_value;
202}
203
204#endif /* (XML_COMBINED_VERSION >= 19505) */
205
206PyDoc_STRVAR(pyexpat_xmlparser___dir____doc__,
207"__dir__($self, /)\n"
Zachary Ware8ef887c2015-04-13 18:22:35 -0500208"--\n"
209"\n");
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300210
211#define PYEXPAT_XMLPARSER___DIR___METHODDEF \
212 {"__dir__", (PyCFunction)pyexpat_xmlparser___dir__, METH_NOARGS, pyexpat_xmlparser___dir____doc__},
213
214static PyObject *
215pyexpat_xmlparser___dir___impl(xmlparseobject *self);
216
217static PyObject *
218pyexpat_xmlparser___dir__(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
219{
220 return pyexpat_xmlparser___dir___impl(self);
221}
222
223PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
224"ParserCreate($module, /, encoding=None, namespace_separator=None,\n"
225" intern=None)\n"
226"--\n"
227"\n"
228"Return a new XML parser object.");
229
230#define PYEXPAT_PARSERCREATE_METHODDEF \
231 {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_VARARGS|METH_KEYWORDS, pyexpat_ParserCreate__doc__},
232
233static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300234pyexpat_ParserCreate_impl(PyObject *module, const char *encoding,
Larry Hastings89964c42015-04-14 18:07:59 -0400235 const char *namespace_separator, PyObject *intern);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300236
237static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300238pyexpat_ParserCreate(PyObject *module, PyObject *args, PyObject *kwargs)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300239{
240 PyObject *return_value = NULL;
241 static char *_keywords[] = {"encoding", "namespace_separator", "intern", NULL};
242 const char *encoding = NULL;
243 const char *namespace_separator = NULL;
244 PyObject *intern = NULL;
245
Serhiy Storchaka247789c2015-04-24 00:40:51 +0300246 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zzO:ParserCreate", _keywords,
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300247 &encoding, &namespace_separator, &intern))
248 goto exit;
249 return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
250
251exit:
252 return return_value;
253}
254
255PyDoc_STRVAR(pyexpat_ErrorString__doc__,
256"ErrorString($module, code, /)\n"
257"--\n"
258"\n"
259"Returns string error for given number.");
260
261#define PYEXPAT_ERRORSTRING_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +0300262 {"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_O, pyexpat_ErrorString__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300263
264static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300265pyexpat_ErrorString_impl(PyObject *module, long code);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300266
267static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300268pyexpat_ErrorString(PyObject *module, PyObject *arg)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300269{
270 PyObject *return_value = NULL;
271 long code;
272
Serhiy Storchaka247789c2015-04-24 00:40:51 +0300273 if (!PyArg_Parse(arg, "l:ErrorString", &code))
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300274 goto exit;
275 return_value = pyexpat_ErrorString_impl(module, code);
276
277exit:
278 return return_value;
279}
280
281#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
282 #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
283#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +0300284/*[clinic end generated code: output=d479cfab607e9dc8 input=a9049054013a1b77]*/