lxml 5.3.2__cp310-cp310-win32.win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. lxml/ElementInclude.py +244 -0
  2. lxml/__init__.py +22 -0
  3. lxml/_elementpath.cp310-win32.pyd +0 -0
  4. lxml/_elementpath.py +341 -0
  5. lxml/apihelpers.pxi +1793 -0
  6. lxml/builder.cp310-win32.pyd +0 -0
  7. lxml/builder.py +232 -0
  8. lxml/classlookup.pxi +580 -0
  9. lxml/cleanup.pxi +215 -0
  10. lxml/cssselect.py +101 -0
  11. lxml/debug.pxi +90 -0
  12. lxml/docloader.pxi +178 -0
  13. lxml/doctestcompare.py +488 -0
  14. lxml/dtd.pxi +479 -0
  15. lxml/etree.cp310-win32.pyd +0 -0
  16. lxml/etree.h +248 -0
  17. lxml/etree.pyx +3732 -0
  18. lxml/etree_api.h +195 -0
  19. lxml/extensions.pxi +833 -0
  20. lxml/html/ElementSoup.py +10 -0
  21. lxml/html/__init__.py +1923 -0
  22. lxml/html/_diffcommand.py +86 -0
  23. lxml/html/_html5builder.py +100 -0
  24. lxml/html/_setmixin.py +56 -0
  25. lxml/html/builder.py +133 -0
  26. lxml/html/clean.py +21 -0
  27. lxml/html/defs.py +135 -0
  28. lxml/html/diff.cp310-win32.pyd +0 -0
  29. lxml/html/diff.py +878 -0
  30. lxml/html/formfill.py +299 -0
  31. lxml/html/html5parser.py +260 -0
  32. lxml/html/soupparser.py +314 -0
  33. lxml/html/usedoctest.py +13 -0
  34. lxml/includes/__init__.pxd +0 -0
  35. lxml/includes/__init__.py +0 -0
  36. lxml/includes/c14n.pxd +25 -0
  37. lxml/includes/config.pxd +3 -0
  38. lxml/includes/dtdvalid.pxd +18 -0
  39. lxml/includes/etree_defs.h +379 -0
  40. lxml/includes/etreepublic.pxd +237 -0
  41. lxml/includes/extlibs/__init__.py +0 -0
  42. lxml/includes/extlibs/zconf.h +543 -0
  43. lxml/includes/extlibs/zlib.h +1938 -0
  44. lxml/includes/htmlparser.pxd +56 -0
  45. lxml/includes/libexslt/__init__.py +0 -0
  46. lxml/includes/libexslt/exslt.h +108 -0
  47. lxml/includes/libexslt/exsltconfig.h +70 -0
  48. lxml/includes/libexslt/exsltexports.h +63 -0
  49. lxml/includes/libexslt/libexslt.h +29 -0
  50. lxml/includes/libxml/HTMLparser.h +320 -0
  51. lxml/includes/libxml/HTMLtree.h +147 -0
  52. lxml/includes/libxml/SAX.h +204 -0
  53. lxml/includes/libxml/SAX2.h +173 -0
  54. lxml/includes/libxml/__init__.py +0 -0
  55. lxml/includes/libxml/c14n.h +128 -0
  56. lxml/includes/libxml/catalog.h +182 -0
  57. lxml/includes/libxml/chvalid.h +230 -0
  58. lxml/includes/libxml/debugXML.h +217 -0
  59. lxml/includes/libxml/dict.h +81 -0
  60. lxml/includes/libxml/encoding.h +233 -0
  61. lxml/includes/libxml/entities.h +151 -0
  62. lxml/includes/libxml/globals.h +529 -0
  63. lxml/includes/libxml/hash.h +236 -0
  64. lxml/includes/libxml/list.h +137 -0
  65. lxml/includes/libxml/nanoftp.h +186 -0
  66. lxml/includes/libxml/nanohttp.h +81 -0
  67. lxml/includes/libxml/parser.h +1265 -0
  68. lxml/includes/libxml/parserInternals.h +662 -0
  69. lxml/includes/libxml/pattern.h +100 -0
  70. lxml/includes/libxml/relaxng.h +218 -0
  71. lxml/includes/libxml/schemasInternals.h +958 -0
  72. lxml/includes/libxml/schematron.h +142 -0
  73. lxml/includes/libxml/threads.h +94 -0
  74. lxml/includes/libxml/tree.h +1314 -0
  75. lxml/includes/libxml/uri.h +94 -0
  76. lxml/includes/libxml/valid.h +448 -0
  77. lxml/includes/libxml/xinclude.h +129 -0
  78. lxml/includes/libxml/xlink.h +189 -0
  79. lxml/includes/libxml/xmlIO.h +369 -0
  80. lxml/includes/libxml/xmlautomata.h +146 -0
  81. lxml/includes/libxml/xmlerror.h +919 -0
  82. lxml/includes/libxml/xmlexports.h +50 -0
  83. lxml/includes/libxml/xmlmemory.h +228 -0
  84. lxml/includes/libxml/xmlmodule.h +57 -0
  85. lxml/includes/libxml/xmlreader.h +428 -0
  86. lxml/includes/libxml/xmlregexp.h +222 -0
  87. lxml/includes/libxml/xmlsave.h +88 -0
  88. lxml/includes/libxml/xmlschemas.h +246 -0
  89. lxml/includes/libxml/xmlschemastypes.h +152 -0
  90. lxml/includes/libxml/xmlstring.h +140 -0
  91. lxml/includes/libxml/xmlunicode.h +202 -0
  92. lxml/includes/libxml/xmlversion.h +526 -0
  93. lxml/includes/libxml/xmlwriter.h +488 -0
  94. lxml/includes/libxml/xpath.h +575 -0
  95. lxml/includes/libxml/xpathInternals.h +632 -0
  96. lxml/includes/libxml/xpointer.h +137 -0
  97. lxml/includes/libxslt/__init__.py +0 -0
  98. lxml/includes/libxslt/attributes.h +39 -0
  99. lxml/includes/libxslt/documents.h +93 -0
  100. lxml/includes/libxslt/extensions.h +262 -0
  101. lxml/includes/libxslt/extra.h +72 -0
  102. lxml/includes/libxslt/functions.h +78 -0
  103. lxml/includes/libxslt/imports.h +75 -0
  104. lxml/includes/libxslt/keys.h +53 -0
  105. lxml/includes/libxslt/libxslt.h +36 -0
  106. lxml/includes/libxslt/namespaces.h +68 -0
  107. lxml/includes/libxslt/numbersInternals.h +73 -0
  108. lxml/includes/libxslt/preproc.h +43 -0
  109. lxml/includes/libxslt/security.h +104 -0
  110. lxml/includes/libxslt/templates.h +77 -0
  111. lxml/includes/libxslt/transform.h +207 -0
  112. lxml/includes/libxslt/trio.h +216 -0
  113. lxml/includes/libxslt/triodef.h +220 -0
  114. lxml/includes/libxslt/variables.h +118 -0
  115. lxml/includes/libxslt/win32config.h +51 -0
  116. lxml/includes/libxslt/xslt.h +110 -0
  117. lxml/includes/libxslt/xsltInternals.h +1992 -0
  118. lxml/includes/libxslt/xsltconfig.h +179 -0
  119. lxml/includes/libxslt/xsltexports.h +64 -0
  120. lxml/includes/libxslt/xsltlocale.h +44 -0
  121. lxml/includes/libxslt/xsltutils.h +343 -0
  122. lxml/includes/lxml-version.h +3 -0
  123. lxml/includes/relaxng.pxd +64 -0
  124. lxml/includes/schematron.pxd +34 -0
  125. lxml/includes/tree.pxd +494 -0
  126. lxml/includes/uri.pxd +5 -0
  127. lxml/includes/xinclude.pxd +22 -0
  128. lxml/includes/xmlerror.pxd +852 -0
  129. lxml/includes/xmlparser.pxd +265 -0
  130. lxml/includes/xmlschema.pxd +35 -0
  131. lxml/includes/xpath.pxd +136 -0
  132. lxml/includes/xslt.pxd +190 -0
  133. lxml/isoschematron/__init__.py +348 -0
  134. lxml/isoschematron/resources/rng/iso-schematron.rng +709 -0
  135. lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl +75 -0
  136. lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl +77 -0
  137. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl +313 -0
  138. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl +1160 -0
  139. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
  140. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1796 -0
  141. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +588 -0
  142. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt +84 -0
  143. lxml/iterparse.pxi +438 -0
  144. lxml/lxml.etree.h +248 -0
  145. lxml/lxml.etree_api.h +195 -0
  146. lxml/nsclasses.pxi +281 -0
  147. lxml/objectify.cp310-win32.pyd +0 -0
  148. lxml/objectify.pyx +2145 -0
  149. lxml/objectpath.pxi +332 -0
  150. lxml/parser.pxi +2000 -0
  151. lxml/parsertarget.pxi +180 -0
  152. lxml/proxy.pxi +619 -0
  153. lxml/public-api.pxi +178 -0
  154. lxml/pyclasslookup.py +3 -0
  155. lxml/readonlytree.pxi +565 -0
  156. lxml/relaxng.pxi +165 -0
  157. lxml/sax.cp310-win32.pyd +0 -0
  158. lxml/sax.py +275 -0
  159. lxml/saxparser.pxi +875 -0
  160. lxml/schematron.pxi +168 -0
  161. lxml/serializer.pxi +1781 -0
  162. lxml/usedoctest.py +13 -0
  163. lxml/xinclude.pxi +67 -0
  164. lxml/xmlerror.pxi +1654 -0
  165. lxml/xmlid.pxi +179 -0
  166. lxml/xmlschema.pxi +215 -0
  167. lxml/xpath.pxi +487 -0
  168. lxml/xslt.pxi +950 -0
  169. lxml/xsltext.pxi +242 -0
  170. lxml-5.3.2.dist-info/METADATA +100 -0
  171. lxml-5.3.2.dist-info/RECORD +175 -0
  172. lxml-5.3.2.dist-info/WHEEL +5 -0
  173. lxml-5.3.2.dist-info/licenses/LICENSE.txt +29 -0
  174. lxml-5.3.2.dist-info/licenses/LICENSES.txt +29 -0
  175. lxml-5.3.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,265 @@
1
+ from libc.string cimport const_char
2
+
3
+ from lxml.includes.tree cimport (
4
+ xmlDoc, xmlNode, xmlEntity, xmlDict, xmlDtd, xmlChar, const_xmlChar)
5
+ from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback
6
+ from lxml.includes.xmlerror cimport xmlError, xmlStructuredErrorFunc, xmlErrorLevel
7
+
8
+
9
+ cdef extern from "libxml/parser.h" nogil:
10
+ ctypedef void (*startElementNsSAX2Func)(void* ctx,
11
+ const_xmlChar* localname,
12
+ const_xmlChar* prefix,
13
+ const_xmlChar* URI,
14
+ int nb_namespaces,
15
+ const_xmlChar** namespaces,
16
+ int nb_attributes,
17
+ int nb_defaulted,
18
+ const_xmlChar** attributes) noexcept
19
+
20
+ ctypedef void (*endElementNsSAX2Func)(void* ctx,
21
+ const_xmlChar* localname,
22
+ const_xmlChar* prefix,
23
+ const_xmlChar* URI) noexcept
24
+
25
+ ctypedef void (*startElementSAXFunc)(void* ctx, const_xmlChar* name, const_xmlChar** atts) noexcept
26
+
27
+ ctypedef void (*endElementSAXFunc)(void* ctx, const_xmlChar* name) noexcept
28
+
29
+ ctypedef void (*charactersSAXFunc)(void* ctx, const_xmlChar* ch, int len) noexcept
30
+
31
+ ctypedef void (*cdataBlockSAXFunc)(void* ctx, const_xmlChar* value, int len) noexcept
32
+
33
+ ctypedef void (*commentSAXFunc)(void* ctx, const_xmlChar* value) noexcept
34
+
35
+ ctypedef void (*processingInstructionSAXFunc)(void* ctx,
36
+ const_xmlChar* target,
37
+ const_xmlChar* data) noexcept
38
+
39
+ ctypedef void (*internalSubsetSAXFunc)(void* ctx,
40
+ const_xmlChar* name,
41
+ const_xmlChar* externalID,
42
+ const_xmlChar* systemID) noexcept
43
+
44
+ ctypedef void (*endDocumentSAXFunc)(void* ctx) noexcept
45
+
46
+ ctypedef void (*startDocumentSAXFunc)(void* ctx) noexcept
47
+
48
+ ctypedef void (*referenceSAXFunc)(void * ctx, const_xmlChar* name) noexcept
49
+
50
+ ctypedef xmlEntity* (*getEntitySAXFunc)(void* ctx, const_xmlChar* name) noexcept
51
+
52
+ cdef int XML_SAX2_MAGIC
53
+
54
+ cdef extern from "libxml/tree.h" nogil:
55
+ ctypedef struct xmlParserInput:
56
+ int line
57
+ int col
58
+ int length
59
+ const_xmlChar* base
60
+ const_xmlChar* cur
61
+ const_xmlChar* end
62
+ const_char *filename
63
+
64
+ ctypedef struct xmlParserInputBuffer:
65
+ void* context
66
+ xmlInputReadCallback readcallback
67
+ xmlInputCloseCallback closecallback
68
+
69
+ ctypedef struct xmlSAXHandlerV1:
70
+ # same as xmlSAXHandler, but without namespaces
71
+ pass
72
+
73
+ ctypedef struct xmlSAXHandler:
74
+ internalSubsetSAXFunc internalSubset
75
+ startElementNsSAX2Func startElementNs
76
+ endElementNsSAX2Func endElementNs
77
+ startElementSAXFunc startElement
78
+ endElementSAXFunc endElement
79
+ charactersSAXFunc characters
80
+ cdataBlockSAXFunc cdataBlock
81
+ referenceSAXFunc reference
82
+ getEntitySAXFunc getEntity
83
+ commentSAXFunc comment
84
+ processingInstructionSAXFunc processingInstruction
85
+ startDocumentSAXFunc startDocument
86
+ endDocumentSAXFunc endDocument
87
+ int initialized
88
+ xmlStructuredErrorFunc serror
89
+ void* _private
90
+
91
+
92
+ cdef extern from "libxml/SAX2.h" nogil:
93
+ cdef void xmlSAX2StartDocument(void* ctxt)
94
+
95
+
96
+ cdef extern from "libxml/xmlIO.h" nogil:
97
+ cdef xmlParserInputBuffer* xmlAllocParserInputBuffer(int enc)
98
+
99
+
100
+ cdef extern from "libxml/parser.h" nogil:
101
+
102
+ cdef xmlDict* xmlDictCreate()
103
+ cdef xmlDict* xmlDictCreateSub(xmlDict* subdict)
104
+ cdef void xmlDictFree(xmlDict* sub)
105
+ cdef int xmlDictReference(xmlDict* dict)
106
+
107
+ cdef int XML_COMPLETE_ATTRS # SAX option for adding DTD default attributes
108
+ cdef int XML_SKIP_IDS # SAX option for not building an XML ID dict
109
+
110
+ ctypedef enum xmlParserInputState:
111
+ XML_PARSER_EOF = -1 # nothing is to be parsed
112
+ XML_PARSER_START = 0 # nothing has been parsed
113
+ XML_PARSER_MISC = 1 # Misc* before int subset
114
+ XML_PARSER_PI = 2 # Within a processing instruction
115
+ XML_PARSER_DTD = 3 # within some DTD content
116
+ XML_PARSER_PROLOG = 4 # Misc* after internal subset
117
+ XML_PARSER_COMMENT = 5 # within a comment
118
+ XML_PARSER_START_TAG = 6 # within a start tag
119
+ XML_PARSER_CONTENT = 7 # within the content
120
+ XML_PARSER_CDATA_SECTION = 8 # within a CDATA section
121
+ XML_PARSER_END_TAG = 9 # within a closing tag
122
+ XML_PARSER_ENTITY_DECL = 10 # within an entity declaration
123
+ XML_PARSER_ENTITY_VALUE = 11 # within an entity value in a decl
124
+ XML_PARSER_ATTRIBUTE_VALUE = 12 # within an attribute value
125
+ XML_PARSER_SYSTEM_LITERAL = 13 # within a SYSTEM value
126
+ XML_PARSER_EPILOG = 14 # the Misc* after the last end tag
127
+ XML_PARSER_IGNORE = 15 # within an IGNORED section
128
+ XML_PARSER_PUBLIC_LITERAL = 16 # within a PUBLIC value
129
+
130
+
131
+ ctypedef struct xmlParserCtxt:
132
+ xmlDoc* myDoc
133
+ xmlDict* dict
134
+ int dictNames
135
+ void* _private
136
+ bint wellFormed
137
+ bint recovery
138
+ int options
139
+ bint disableSAX
140
+ int errNo
141
+ xmlParserInputState instate
142
+ bint replaceEntities
143
+ int loadsubset # != 0 if enabled, int value == why
144
+ bint validate
145
+ xmlError lastError
146
+ xmlNode* node
147
+ xmlSAXHandler* sax
148
+ void* userData
149
+ int* spaceTab
150
+ int spaceMax
151
+ int nsNr
152
+ bint html
153
+ bint progressive
154
+ int inSubset
155
+ int charset
156
+ xmlParserInput* input
157
+ int inputNr
158
+ xmlParserInput* inputTab[]
159
+
160
+ ctypedef enum xmlParserOption:
161
+ XML_PARSE_RECOVER = 1 # recover on errors
162
+ XML_PARSE_NOENT = 2 # substitute entities
163
+ XML_PARSE_DTDLOAD = 4 # load the external subset
164
+ XML_PARSE_DTDATTR = 8 # default DTD attributes
165
+ XML_PARSE_DTDVALID = 16 # validate with the DTD
166
+ XML_PARSE_NOERROR = 32 # suppress error reports
167
+ XML_PARSE_NOWARNING = 64 # suppress warning reports
168
+ XML_PARSE_PEDANTIC = 128 # pedantic error reporting
169
+ XML_PARSE_NOBLANKS = 256 # remove blank nodes
170
+ XML_PARSE_SAX1 = 512 # use the SAX1 interface internally
171
+ XML_PARSE_XINCLUDE = 1024 # Implement XInclude substitution
172
+ XML_PARSE_NONET = 2048 # Forbid network access
173
+ XML_PARSE_NODICT = 4096 # Do not reuse the context dictionary
174
+ XML_PARSE_NSCLEAN = 8192 # remove redundant namespaces declarations
175
+ XML_PARSE_NOCDATA = 16384 # merge CDATA as text nodes
176
+ XML_PARSE_NOXINCNODE = 32768 # do not generate XINCLUDE START/END nodes
177
+ # libxml2 2.6.21+ only:
178
+ XML_PARSE_COMPACT = 65536 # compact small text nodes
179
+ # libxml2 2.7.0+ only:
180
+ XML_PARSE_OLD10 = 131072 # parse using XML-1.0 before update 5
181
+ XML_PARSE_NOBASEFIX = 262144 # do not fixup XINCLUDE xml:base uris
182
+ XML_PARSE_HUGE = 524288 # relax any hardcoded limit from the parser
183
+ # libxml2 2.7.3+ only:
184
+ XML_PARSE_OLDSAX = 1048576 # parse using SAX2 interface before 2.7.0
185
+ # libxml2 2.8.0+ only:
186
+ XML_PARSE_IGNORE_ENC = 2097152 # ignore internal document encoding hint
187
+ # libxml2 2.9.0+ only:
188
+ XML_PARSE_BIG_LINES = 4194304 # Store big lines numbers in text PSVI field
189
+
190
+ cdef void xmlInitParser()
191
+ cdef void xmlCleanupParser()
192
+
193
+ cdef int xmlLineNumbersDefault(int onoff)
194
+ cdef xmlParserCtxt* xmlNewParserCtxt()
195
+ cdef xmlParserInput* xmlNewIOInputStream(xmlParserCtxt* ctxt,
196
+ xmlParserInputBuffer* input,
197
+ int enc)
198
+ cdef int xmlCtxtUseOptions(xmlParserCtxt* ctxt, int options)
199
+ cdef void xmlFreeParserCtxt(xmlParserCtxt* ctxt)
200
+ cdef void xmlCtxtReset(xmlParserCtxt* ctxt)
201
+ cdef void xmlClearParserCtxt(xmlParserCtxt* ctxt)
202
+ cdef int xmlParseChunk(xmlParserCtxt* ctxt,
203
+ char* chunk, int size, int terminate)
204
+ cdef xmlDoc* xmlCtxtReadDoc(xmlParserCtxt* ctxt,
205
+ char* cur, char* URL, char* encoding,
206
+ int options)
207
+ cdef xmlDoc* xmlCtxtReadFile(xmlParserCtxt* ctxt,
208
+ char* filename, char* encoding,
209
+ int options)
210
+ cdef xmlDoc* xmlCtxtReadIO(xmlParserCtxt* ctxt,
211
+ xmlInputReadCallback ioread,
212
+ xmlInputCloseCallback ioclose,
213
+ void* ioctx,
214
+ char* URL, char* encoding,
215
+ int options)
216
+ cdef xmlDoc* xmlCtxtReadMemory(xmlParserCtxt* ctxt,
217
+ char* buffer, int size,
218
+ char* filename, const_char* encoding,
219
+ int options)
220
+
221
+ cdef void xmlErrParser(xmlParserCtxt* ctxt, xmlNode* node,
222
+ int domain, int code, xmlErrorLevel level,
223
+ const xmlChar *str1, const xmlChar *str2, const xmlChar *str3,
224
+ int int1, const char *msg, ...)
225
+
226
+
227
+ # iterparse:
228
+
229
+ cdef xmlParserCtxt* xmlCreatePushParserCtxt(xmlSAXHandler* sax,
230
+ void* user_data,
231
+ char* chunk,
232
+ int size,
233
+ char* filename)
234
+
235
+ cdef int xmlCtxtResetPush(xmlParserCtxt* ctxt,
236
+ char* chunk,
237
+ int size,
238
+ char* filename,
239
+ char* encoding)
240
+
241
+ # entity loaders:
242
+
243
+ ctypedef xmlParserInput* (*xmlExternalEntityLoader)(
244
+ const_char * URL, const_char * ID, xmlParserCtxt* context) noexcept
245
+ cdef xmlExternalEntityLoader xmlGetExternalEntityLoader()
246
+ cdef void xmlSetExternalEntityLoader(xmlExternalEntityLoader f)
247
+
248
+ cdef xmlEntity* xmlSAX2GetEntity(void* ctxt, const_xmlChar* name) noexcept
249
+
250
+ # DTDs:
251
+
252
+ cdef xmlDtd* xmlParseDTD(const_xmlChar* ExternalID, const_xmlChar* SystemID)
253
+ cdef xmlDtd* xmlIOParseDTD(xmlSAXHandler* sax,
254
+ xmlParserInputBuffer* input,
255
+ int enc)
256
+
257
+
258
+ cdef extern from "libxml/parserInternals.h" nogil:
259
+ cdef xmlParserInput* xmlNewInputStream(xmlParserCtxt* ctxt)
260
+ cdef xmlParserInput* xmlNewStringInputStream(xmlParserCtxt* ctxt,
261
+ char* buffer)
262
+ cdef xmlParserInput* xmlNewInputFromFile(xmlParserCtxt* ctxt,
263
+ char* filename)
264
+ cdef void xmlFreeInputStream(xmlParserInput* input)
265
+ cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc)
@@ -0,0 +1,35 @@
1
+ from lxml.includes.tree cimport xmlDoc
2
+ from lxml.includes.xmlparser cimport xmlSAXHandler
3
+ from lxml.includes.xmlerror cimport xmlStructuredErrorFunc
4
+
5
+ cdef extern from "libxml/xmlschemas.h" nogil:
6
+ ctypedef struct xmlSchema
7
+ ctypedef struct xmlSchemaParserCtxt
8
+
9
+ ctypedef struct xmlSchemaSAXPlugStruct
10
+ ctypedef struct xmlSchemaValidCtxt
11
+
12
+ ctypedef enum xmlSchemaValidOption:
13
+ XML_SCHEMA_VAL_VC_I_CREATE = 1
14
+
15
+ cdef xmlSchemaValidCtxt* xmlSchemaNewValidCtxt(xmlSchema* schema) nogil
16
+ cdef void xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxt* ctxt,
17
+ xmlStructuredErrorFunc serror, void *ctx)
18
+ cdef void xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxt* ctxt,
19
+ xmlStructuredErrorFunc serror, void *ctx)
20
+
21
+ cdef int xmlSchemaValidateDoc(xmlSchemaValidCtxt* ctxt, xmlDoc* doc) nogil
22
+ cdef xmlSchema* xmlSchemaParse(xmlSchemaParserCtxt* ctxt) nogil
23
+ cdef xmlSchemaParserCtxt* xmlSchemaNewParserCtxt(char* URL) nogil
24
+ cdef xmlSchemaParserCtxt* xmlSchemaNewDocParserCtxt(xmlDoc* doc) nogil
25
+ cdef void xmlSchemaFree(xmlSchema* schema) nogil
26
+ cdef void xmlSchemaFreeParserCtxt(xmlSchemaParserCtxt* ctxt) nogil
27
+ cdef void xmlSchemaFreeValidCtxt(xmlSchemaValidCtxt* ctxt) nogil
28
+ cdef int xmlSchemaSetValidOptions(xmlSchemaValidCtxt* ctxt,
29
+ int options) nogil
30
+
31
+ cdef xmlSchemaSAXPlugStruct* xmlSchemaSAXPlug(xmlSchemaValidCtxt* ctxt,
32
+ xmlSAXHandler** sax,
33
+ void** data) nogil
34
+ cdef int xmlSchemaSAXUnplug(xmlSchemaSAXPlugStruct* sax_plug)
35
+ cdef int xmlSchemaIsValid(xmlSchemaValidCtxt* ctxt)
@@ -0,0 +1,136 @@
1
+ from lxml.includes cimport tree
2
+ from lxml.includes cimport xmlerror
3
+
4
+ from libc.string cimport const_char
5
+ from lxml.includes.tree cimport xmlChar, const_xmlChar
6
+
7
+
8
+ cdef extern from "libxml/xpath.h" nogil:
9
+ ctypedef enum xmlXPathObjectType:
10
+ XPATH_UNDEFINED = 0
11
+ XPATH_NODESET = 1
12
+ XPATH_BOOLEAN = 2
13
+ XPATH_NUMBER = 3
14
+ XPATH_STRING = 4
15
+ XPATH_POINT = 5
16
+ XPATH_RANGE = 6
17
+ XPATH_LOCATIONSET = 7
18
+ XPATH_USERS = 8
19
+ XPATH_XSLT_TREE = 9
20
+
21
+ ctypedef enum xmlXPathError:
22
+ XPATH_EXPRESSION_OK = 0
23
+ XPATH_NUMBER_ERROR = 1
24
+ XPATH_UNFINISHED_LITERAL_ERROR = 2
25
+ XPATH_START_LITERAL_ERROR = 3
26
+ XPATH_VARIABLE_REF_ERROR = 4
27
+ XPATH_UNDEF_VARIABLE_ERROR = 5
28
+ XPATH_INVALID_PREDICATE_ERROR = 6
29
+ XPATH_EXPR_ERROR = 7
30
+ XPATH_UNCLOSED_ERROR = 8
31
+ XPATH_UNKNOWN_FUNC_ERROR = 9
32
+ XPATH_INVALID_OPERAND = 10
33
+ XPATH_INVALID_TYPE = 11
34
+ XPATH_INVALID_ARITY = 12
35
+ XPATH_INVALID_CTXT_SIZE = 13
36
+ XPATH_INVALID_CTXT_POSITION = 14
37
+ XPATH_MEMORY_ERROR = 15
38
+ XPTR_SYNTAX_ERROR = 16
39
+ XPTR_RESOURCE_ERROR = 17
40
+ XPTR_SUB_RESOURCE_ERROR = 18
41
+ XPATH_UNDEF_PREFIX_ERROR = 19
42
+ XPATH_ENCODING_ERROR = 20
43
+ XPATH_INVALID_CHAR_ERROR = 21
44
+ XPATH_INVALID_CTXT = 22
45
+
46
+ ctypedef struct xmlNodeSet:
47
+ int nodeNr
48
+ int nodeMax
49
+ tree.xmlNode** nodeTab
50
+
51
+ ctypedef struct xmlXPathObject:
52
+ xmlXPathObjectType type
53
+ xmlNodeSet* nodesetval
54
+ bint boolval
55
+ double floatval
56
+ xmlChar* stringval
57
+
58
+ ctypedef struct xmlXPathContext:
59
+ tree.xmlDoc* doc
60
+ tree.xmlNode* node
61
+ tree.xmlDict* dict
62
+ tree.xmlHashTable* nsHash
63
+ const_xmlChar* function
64
+ const_xmlChar* functionURI
65
+ xmlerror.xmlStructuredErrorFunc error
66
+ xmlerror.xmlError lastError
67
+ void* userData
68
+
69
+ ctypedef struct xmlXPathParserContext:
70
+ xmlXPathContext* context
71
+ xmlXPathObject* value
72
+ tree.xmlNode* ancestor
73
+ int error
74
+
75
+ ctypedef struct xmlXPathCompExpr
76
+
77
+ ctypedef void (*xmlXPathFunction)(xmlXPathParserContext* ctxt, int nargs)
78
+ ctypedef xmlXPathFunction (*xmlXPathFuncLookupFunc)(void* ctxt,
79
+ const_xmlChar* name,
80
+ const_xmlChar* ns_uri)
81
+
82
+ cdef xmlXPathContext* xmlXPathNewContext(tree.xmlDoc* doc)
83
+ cdef xmlXPathObject* xmlXPathEvalExpression(const_xmlChar* str,
84
+ xmlXPathContext* ctxt)
85
+ cdef xmlXPathObject* xmlXPathCompiledEval(xmlXPathCompExpr* comp,
86
+ xmlXPathContext* ctxt)
87
+ cdef xmlXPathCompExpr* xmlXPathCompile(const_xmlChar* str)
88
+ cdef xmlXPathCompExpr* xmlXPathCtxtCompile(xmlXPathContext* ctxt,
89
+ const_xmlChar* str)
90
+ cdef void xmlXPathFreeContext(xmlXPathContext* ctxt)
91
+ cdef void xmlXPathFreeCompExpr(xmlXPathCompExpr* comp)
92
+ cdef void xmlXPathFreeObject(xmlXPathObject* obj)
93
+ cdef int xmlXPathRegisterNs(xmlXPathContext* ctxt,
94
+ const_xmlChar* prefix, const_xmlChar* ns_uri)
95
+
96
+ cdef xmlNodeSet* xmlXPathNodeSetCreate(tree.xmlNode* val)
97
+ cdef void xmlXPathFreeNodeSet(xmlNodeSet* val)
98
+
99
+
100
+ cdef extern from "libxml/xpathInternals.h" nogil:
101
+ cdef int xmlXPathRegisterFunc(xmlXPathContext* ctxt,
102
+ const_xmlChar* name,
103
+ xmlXPathFunction f)
104
+ cdef int xmlXPathRegisterFuncNS(xmlXPathContext* ctxt,
105
+ const_xmlChar* name,
106
+ const_xmlChar* ns_uri,
107
+ xmlXPathFunction f)
108
+ cdef void xmlXPathRegisterFuncLookup(xmlXPathContext *ctxt,
109
+ xmlXPathFuncLookupFunc f,
110
+ void *funcCtxt)
111
+ cdef int xmlXPathRegisterVariable(xmlXPathContext *ctxt,
112
+ const_xmlChar* name,
113
+ xmlXPathObject* value)
114
+ cdef int xmlXPathRegisterVariableNS(xmlXPathContext *ctxt,
115
+ const_xmlChar* name,
116
+ const_xmlChar* ns_uri,
117
+ xmlXPathObject* value)
118
+ cdef void xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt)
119
+ cdef void xmlXPathRegisteredNsCleanup(xmlXPathContext *ctxt)
120
+ cdef xmlXPathObject* valuePop (xmlXPathParserContext *ctxt)
121
+ cdef int valuePush(xmlXPathParserContext* ctxt, xmlXPathObject *value)
122
+
123
+ cdef xmlXPathObject* xmlXPathNewCString(const_char *val)
124
+ cdef xmlXPathObject* xmlXPathWrapCString(const_char * val)
125
+ cdef xmlXPathObject* xmlXPathNewString(const_xmlChar *val)
126
+ cdef xmlXPathObject* xmlXPathWrapString(const_xmlChar * val)
127
+ cdef xmlXPathObject* xmlXPathNewFloat(double val)
128
+ cdef xmlXPathObject* xmlXPathNewBoolean(int val)
129
+ cdef xmlXPathObject* xmlXPathNewNodeSet(tree.xmlNode* val)
130
+ cdef xmlXPathObject* xmlXPathNewValueTree(tree.xmlNode* val)
131
+ cdef void xmlXPathNodeSetAdd(xmlNodeSet* cur,
132
+ tree.xmlNode* val)
133
+ cdef void xmlXPathNodeSetAddUnique(xmlNodeSet* cur,
134
+ tree.xmlNode* val)
135
+ cdef xmlXPathObject* xmlXPathWrapNodeSet(xmlNodeSet* val)
136
+ cdef void xmlXPathErr(xmlXPathParserContext* ctxt, int error)
lxml/includes/xslt.pxd ADDED
@@ -0,0 +1,190 @@
1
+ from lxml.includes.tree cimport xmlDoc, xmlNode, xmlDict, xmlChar, const_xmlChar, xmlOutputBuffer
2
+ from lxml.includes.xmlerror cimport xmlGenericErrorFunc
3
+ from lxml.includes.xpath cimport xmlXPathContext, xmlXPathFunction
4
+
5
+ from libc.string cimport const_char
6
+
7
+ cdef extern from "libxslt/xslt.h":
8
+ cdef int xsltLibxsltVersion
9
+ cdef int xsltMaxDepth
10
+
11
+ cdef extern from "libxslt/xsltconfig.h":
12
+ cdef int LIBXSLT_VERSION
13
+
14
+ cdef extern from "libxslt/xsltInternals.h" nogil:
15
+ ctypedef enum xsltTransformState:
16
+ XSLT_STATE_OK # 0
17
+ XSLT_STATE_ERROR # 1
18
+ XSLT_STATE_STOPPED # 2
19
+
20
+ ctypedef struct xsltDocument:
21
+ xmlDoc* doc
22
+
23
+ ctypedef struct xsltStylesheet:
24
+ xmlChar* encoding
25
+ xmlDoc* doc
26
+ int errors
27
+
28
+ ctypedef struct xsltTransformContext:
29
+ xsltStylesheet* style
30
+ xmlXPathContext* xpathCtxt
31
+ xsltDocument* document
32
+ void* _private
33
+ xmlDict* dict
34
+ int profile
35
+ xmlNode* node
36
+ xmlDoc* output
37
+ xmlNode* insert
38
+ xmlNode* inst
39
+ xsltTransformState state
40
+
41
+ ctypedef struct xsltStackElem
42
+
43
+ ctypedef struct xsltTemplate
44
+
45
+ cdef xsltStylesheet* xsltParseStylesheetDoc(xmlDoc* doc)
46
+ cdef void xsltFreeStylesheet(xsltStylesheet* sheet)
47
+
48
+ cdef extern from "libxslt/imports.h" nogil:
49
+ # actually defined in "etree_defs.h"
50
+ cdef void LXML_GET_XSLT_ENCODING(const_xmlChar* result_var, xsltStylesheet* style)
51
+
52
+ cdef extern from "libxslt/extensions.h" nogil:
53
+ ctypedef void (*xsltTransformFunction)(xsltTransformContext* ctxt,
54
+ xmlNode* context_node,
55
+ xmlNode* inst,
56
+ void* precomp_unused) noexcept
57
+
58
+ cdef int xsltRegisterExtFunction(xsltTransformContext* ctxt,
59
+ const_xmlChar* name,
60
+ const_xmlChar* URI,
61
+ xmlXPathFunction function)
62
+ cdef int xsltRegisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI,
63
+ xmlXPathFunction function)
64
+ cdef int xsltUnregisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI)
65
+ cdef xmlXPathFunction xsltExtModuleFunctionLookup(
66
+ const_xmlChar* name, const_xmlChar* URI)
67
+ cdef int xsltRegisterExtPrefix(xsltStylesheet* style,
68
+ const_xmlChar* prefix, const_xmlChar* URI)
69
+ cdef int xsltRegisterExtElement(xsltTransformContext* ctxt,
70
+ const_xmlChar* name, const_xmlChar* URI,
71
+ xsltTransformFunction function)
72
+
73
+ cdef extern from "libxslt/documents.h" nogil:
74
+ ctypedef enum xsltLoadType:
75
+ XSLT_LOAD_START
76
+ XSLT_LOAD_STYLESHEET
77
+ XSLT_LOAD_DOCUMENT
78
+
79
+ ctypedef xmlDoc* (*xsltDocLoaderFunc)(const_xmlChar* URI, xmlDict* dict,
80
+ int options,
81
+ void* ctxt,
82
+ xsltLoadType type) noexcept
83
+ cdef xsltDocLoaderFunc xsltDocDefaultLoader
84
+ cdef void xsltSetLoaderFunc(xsltDocLoaderFunc f)
85
+
86
+ cdef extern from "libxslt/transform.h" nogil:
87
+ cdef xmlDoc* xsltApplyStylesheet(xsltStylesheet* style, xmlDoc* doc,
88
+ const_char** params)
89
+ cdef xmlDoc* xsltApplyStylesheetUser(xsltStylesheet* style, xmlDoc* doc,
90
+ const_char** params, const_char* output,
91
+ void* profile,
92
+ xsltTransformContext* context)
93
+ cdef void xsltProcessOneNode(xsltTransformContext* ctxt,
94
+ xmlNode* contextNode,
95
+ xsltStackElem* params)
96
+ cdef xsltTransformContext* xsltNewTransformContext(xsltStylesheet* style,
97
+ xmlDoc* doc)
98
+ cdef void xsltFreeTransformContext(xsltTransformContext* context)
99
+ cdef void xsltApplyOneTemplate(xsltTransformContext* ctxt,
100
+ xmlNode* contextNode, xmlNode* list,
101
+ xsltTemplate* templ,
102
+ xsltStackElem* params)
103
+
104
+
105
+ cdef extern from "libxslt/xsltutils.h" nogil:
106
+ cdef int xsltSaveResultToString(xmlChar** doc_txt_ptr,
107
+ int* doc_txt_len,
108
+ xmlDoc* result,
109
+ xsltStylesheet* style)
110
+ cdef int xsltSaveResultToFilename(const_char *URL,
111
+ xmlDoc* result,
112
+ xsltStylesheet* style,
113
+ int compression)
114
+ cdef int xsltSaveResultTo(xmlOutputBuffer* buf,
115
+ xmlDoc* result,
116
+ xsltStylesheet* style)
117
+ cdef xmlGenericErrorFunc xsltGenericError
118
+ cdef void *xsltGenericErrorContext
119
+ cdef void xsltSetGenericErrorFunc(
120
+ void* ctxt, void (*handler)(void* ctxt, char* msg, ...) nogil)
121
+ cdef void xsltSetTransformErrorFunc(
122
+ xsltTransformContext*, void* ctxt,
123
+ void (*handler)(void* ctxt, char* msg, ...) nogil)
124
+ cdef void xsltTransformError(xsltTransformContext* ctxt,
125
+ xsltStylesheet* style,
126
+ xmlNode* node, char* msg, ...)
127
+ cdef void xsltSetCtxtParseOptions(
128
+ xsltTransformContext* ctxt, int options)
129
+
130
+
131
+ cdef extern from "libxslt/security.h" nogil:
132
+ ctypedef struct xsltSecurityPrefs
133
+ ctypedef enum xsltSecurityOption:
134
+ XSLT_SECPREF_READ_FILE = 1
135
+ XSLT_SECPREF_WRITE_FILE = 2
136
+ XSLT_SECPREF_CREATE_DIRECTORY = 3
137
+ XSLT_SECPREF_READ_NETWORK = 4
138
+ XSLT_SECPREF_WRITE_NETWORK = 5
139
+
140
+ ctypedef int (*xsltSecurityCheck)(xsltSecurityPrefs* sec,
141
+ xsltTransformContext* ctxt,
142
+ char* value) noexcept
143
+
144
+ cdef xsltSecurityPrefs* xsltNewSecurityPrefs()
145
+ cdef void xsltFreeSecurityPrefs(xsltSecurityPrefs* sec)
146
+ cdef int xsltSecurityForbid(xsltSecurityPrefs* sec,
147
+ xsltTransformContext* ctxt,
148
+ char* value)
149
+ cdef int xsltSecurityAllow(xsltSecurityPrefs* sec,
150
+ xsltTransformContext* ctxt,
151
+ char* value)
152
+ cdef int xsltSetSecurityPrefs(xsltSecurityPrefs* sec,
153
+ xsltSecurityOption option,
154
+ xsltSecurityCheck func)
155
+ cdef xsltSecurityCheck xsltGetSecurityPrefs(
156
+ xsltSecurityPrefs* sec,
157
+ xsltSecurityOption option)
158
+ cdef int xsltSetCtxtSecurityPrefs(xsltSecurityPrefs* sec,
159
+ xsltTransformContext* ctxt)
160
+ cdef xmlDoc* xsltGetProfileInformation(xsltTransformContext* ctxt)
161
+
162
+ cdef extern from "libxslt/variables.h" nogil:
163
+ cdef int xsltQuoteUserParams(xsltTransformContext* ctxt,
164
+ const_char** params)
165
+ cdef int xsltQuoteOneUserParam(xsltTransformContext* ctxt,
166
+ const_xmlChar* name,
167
+ const_xmlChar* value)
168
+
169
+ cdef extern from "libxslt/extra.h" nogil:
170
+ const_xmlChar* XSLT_LIBXSLT_NAMESPACE
171
+ const_xmlChar* XSLT_XALAN_NAMESPACE
172
+ const_xmlChar* XSLT_SAXON_NAMESPACE
173
+ const_xmlChar* XSLT_XT_NAMESPACE
174
+
175
+ cdef xmlXPathFunction xsltFunctionNodeSet
176
+ cdef void xsltRegisterAllExtras()
177
+
178
+ cdef extern from "libexslt/exslt.h" nogil:
179
+ cdef void exsltRegisterAll()
180
+
181
+ # libexslt 1.1.25+
182
+ const_xmlChar* EXSLT_DATE_NAMESPACE
183
+ const_xmlChar* EXSLT_SETS_NAMESPACE
184
+ const_xmlChar* EXSLT_MATH_NAMESPACE
185
+ const_xmlChar* EXSLT_STRINGS_NAMESPACE
186
+
187
+ cdef int exsltDateXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix)
188
+ cdef int exsltSetsXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix)
189
+ cdef int exsltMathXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix)
190
+ cdef int exsltStrXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix)