lxml 5.4.0__cp38-cp38-win32.whl → 6.0.0__cp38-cp38-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.
- lxml/__init__.py +1 -1
- lxml/_elementpath.cp38-win32.pyd +0 -0
- lxml/_elementpath.py +3 -1
- lxml/apihelpers.pxi +25 -17
- lxml/builder.cp38-win32.pyd +0 -0
- lxml/builder.py +11 -0
- lxml/debug.pxi +0 -54
- lxml/etree.cp38-win32.pyd +0 -0
- lxml/etree.h +244 -248
- lxml/etree.pyx +154 -33
- lxml/etree_api.h +204 -195
- lxml/extensions.pxi +3 -6
- lxml/html/__init__.py +7 -3
- lxml/html/_difflib.cp38-win32.pyd +0 -0
- lxml/html/_difflib.py +2106 -0
- lxml/html/builder.py +40 -0
- lxml/html/defs.py +3 -3
- lxml/html/diff.cp38-win32.pyd +0 -0
- lxml/html/diff.py +406 -312
- lxml/includes/etree_defs.h +6 -6
- lxml/includes/lxml-version.h +1 -1
- lxml/includes/tree.pxd +10 -12
- lxml/includes/xmlparser.pxd +46 -8
- lxml/lxml.etree.h +24 -28
- lxml/lxml.etree_api.h +59 -50
- lxml/objectify.cp38-win32.pyd +0 -0
- lxml/objectify.pyx +11 -7
- lxml/parser.pxi +106 -47
- lxml/sax.cp38-win32.pyd +0 -0
- lxml/sax.py +11 -0
- lxml/saxparser.pxi +14 -14
- lxml/schematron.pxi +8 -3
- lxml/serializer.pxi +71 -3
- lxml/xslt.pxi +10 -3
- {lxml-5.4.0.dist-info → lxml-6.0.0.dist-info}/LICENSE.txt +3 -1
- lxml-6.0.0.dist-info/METADATA +150 -0
- {lxml-5.4.0.dist-info → lxml-6.0.0.dist-info}/RECORD +40 -38
- lxml-5.4.0.dist-info/METADATA +0 -83
- {lxml-5.4.0.dist-info → lxml-6.0.0.dist-info}/LICENSES.txt +0 -0
- {lxml-5.4.0.dist-info → lxml-6.0.0.dist-info}/WHEEL +0 -0
- {lxml-5.4.0.dist-info → lxml-6.0.0.dist-info}/top_level.txt +0 -0
lxml/etree_api.h
CHANGED
@@ -1,195 +1,204 @@
|
|
1
|
-
/* Generated by Cython 3.
|
2
|
-
|
3
|
-
#ifndef __PYX_HAVE_API__lxml__etree
|
4
|
-
#define __PYX_HAVE_API__lxml__etree
|
5
|
-
#ifdef __MINGW64__
|
6
|
-
#define MS_WIN64
|
7
|
-
#endif
|
8
|
-
#include "Python.h"
|
9
|
-
#include "etree.h"
|
10
|
-
|
11
|
-
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_deepcopyNodeToDocument)(struct LxmlDocument *, xmlNode *) = 0;
|
12
|
-
#define deepcopyNodeToDocument __pyx_api_f_4lxml_5etree_deepcopyNodeToDocument
|
13
|
-
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_elementTreeFactory)(struct LxmlElement *) = 0;
|
14
|
-
#define elementTreeFactory __pyx_api_f_4lxml_5etree_elementTreeFactory
|
15
|
-
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_newElementTree)(struct LxmlElement *, PyObject *) = 0;
|
16
|
-
#define newElementTree __pyx_api_f_4lxml_5etree_newElementTree
|
17
|
-
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_adoptExternalDocument)(xmlDoc *, PyObject *, int) = 0;
|
18
|
-
#define adoptExternalDocument __pyx_api_f_4lxml_5etree_adoptExternalDocument
|
19
|
-
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_elementFactory)(struct LxmlDocument *, xmlNode *) = 0;
|
20
|
-
#define elementFactory __pyx_api_f_4lxml_5etree_elementFactory
|
21
|
-
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_makeElement)(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *) = 0;
|
22
|
-
#define makeElement __pyx_api_f_4lxml_5etree_makeElement
|
23
|
-
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_makeSubElement)(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *) = 0;
|
24
|
-
#define makeSubElement __pyx_api_f_4lxml_5etree_makeSubElement
|
25
|
-
static void (*__pyx_api_f_4lxml_5etree_setElementClassLookupFunction)(_element_class_lookup_function, PyObject *) = 0;
|
26
|
-
#define setElementClassLookupFunction __pyx_api_f_4lxml_5etree_setElementClassLookupFunction
|
27
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_lookupDefaultElementClass)(PyObject *, PyObject *, xmlNode *) = 0;
|
28
|
-
#define lookupDefaultElementClass __pyx_api_f_4lxml_5etree_lookupDefaultElementClass
|
29
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_lookupNamespaceElementClass)(PyObject *, PyObject *, xmlNode *) = 0;
|
30
|
-
#define lookupNamespaceElementClass __pyx_api_f_4lxml_5etree_lookupNamespaceElementClass
|
31
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_callLookupFallback)(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *) = 0;
|
32
|
-
#define callLookupFallback __pyx_api_f_4lxml_5etree_callLookupFallback
|
33
|
-
static int (*__pyx_api_f_4lxml_5etree_tagMatches)(xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
34
|
-
#define tagMatches __pyx_api_f_4lxml_5etree_tagMatches
|
35
|
-
static struct LxmlDocument *(*__pyx_api_f_4lxml_5etree_documentOrRaise)(PyObject *) = 0;
|
36
|
-
#define documentOrRaise __pyx_api_f_4lxml_5etree_documentOrRaise
|
37
|
-
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_rootNodeOrRaise)(PyObject *) = 0;
|
38
|
-
#define rootNodeOrRaise __pyx_api_f_4lxml_5etree_rootNodeOrRaise
|
39
|
-
static int (*__pyx_api_f_4lxml_5etree_hasText)(xmlNode *) = 0;
|
40
|
-
#define hasText __pyx_api_f_4lxml_5etree_hasText
|
41
|
-
static int (*__pyx_api_f_4lxml_5etree_hasTail)(xmlNode *) = 0;
|
42
|
-
#define hasTail __pyx_api_f_4lxml_5etree_hasTail
|
43
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_textOf)(xmlNode *) = 0;
|
44
|
-
#define textOf __pyx_api_f_4lxml_5etree_textOf
|
45
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_tailOf)(xmlNode *) = 0;
|
46
|
-
#define tailOf __pyx_api_f_4lxml_5etree_tailOf
|
47
|
-
static int (*__pyx_api_f_4lxml_5etree_setNodeText)(xmlNode *, PyObject *) = 0;
|
48
|
-
#define setNodeText __pyx_api_f_4lxml_5etree_setNodeText
|
49
|
-
static int (*__pyx_api_f_4lxml_5etree_setTailText)(xmlNode *, PyObject *) = 0;
|
50
|
-
#define setTailText __pyx_api_f_4lxml_5etree_setTailText
|
51
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_attributeValue)(xmlNode *, xmlAttr *) = 0;
|
52
|
-
#define attributeValue __pyx_api_f_4lxml_5etree_attributeValue
|
53
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_attributeValueFromNsName)(xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
54
|
-
#define attributeValueFromNsName __pyx_api_f_4lxml_5etree_attributeValueFromNsName
|
55
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_getAttributeValue)(struct LxmlElement *, PyObject *, PyObject *) = 0;
|
56
|
-
#define getAttributeValue __pyx_api_f_4lxml_5etree_getAttributeValue
|
57
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_iterattributes)(struct LxmlElement *, int) = 0;
|
58
|
-
#define iterattributes __pyx_api_f_4lxml_5etree_iterattributes
|
59
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_collectAttributes)(xmlNode *, int) = 0;
|
60
|
-
#define collectAttributes __pyx_api_f_4lxml_5etree_collectAttributes
|
61
|
-
static int (*__pyx_api_f_4lxml_5etree_setAttributeValue)(struct LxmlElement *, PyObject *, PyObject *) = 0;
|
62
|
-
#define setAttributeValue __pyx_api_f_4lxml_5etree_setAttributeValue
|
63
|
-
static int (*__pyx_api_f_4lxml_5etree_delAttribute)(struct LxmlElement *, PyObject *) = 0;
|
64
|
-
#define delAttribute __pyx_api_f_4lxml_5etree_delAttribute
|
65
|
-
static int (*__pyx_api_f_4lxml_5etree_delAttributeFromNsName)(xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
66
|
-
#define delAttributeFromNsName __pyx_api_f_4lxml_5etree_delAttributeFromNsName
|
67
|
-
static int (*__pyx_api_f_4lxml_5etree_hasChild)(xmlNode *) = 0;
|
68
|
-
#define hasChild __pyx_api_f_4lxml_5etree_hasChild
|
69
|
-
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChild)(xmlNode *, Py_ssize_t) = 0;
|
70
|
-
#define findChild __pyx_api_f_4lxml_5etree_findChild
|
71
|
-
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChildForwards)(xmlNode *, Py_ssize_t) = 0;
|
72
|
-
#define findChildForwards __pyx_api_f_4lxml_5etree_findChildForwards
|
73
|
-
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChildBackwards)(xmlNode *, Py_ssize_t) = 0;
|
74
|
-
#define findChildBackwards __pyx_api_f_4lxml_5etree_findChildBackwards
|
75
|
-
static xmlNode *(*__pyx_api_f_4lxml_5etree_nextElement)(xmlNode *) = 0;
|
76
|
-
#define nextElement __pyx_api_f_4lxml_5etree_nextElement
|
77
|
-
static xmlNode *(*__pyx_api_f_4lxml_5etree_previousElement)(xmlNode *) = 0;
|
78
|
-
#define previousElement __pyx_api_f_4lxml_5etree_previousElement
|
79
|
-
static void (*__pyx_api_f_4lxml_5etree_appendChild)(struct LxmlElement *, struct LxmlElement *) = 0;
|
80
|
-
#define appendChild __pyx_api_f_4lxml_5etree_appendChild
|
81
|
-
static int (*__pyx_api_f_4lxml_5etree_appendChildToElement)(struct LxmlElement *, struct LxmlElement *) = 0;
|
82
|
-
#define appendChildToElement __pyx_api_f_4lxml_5etree_appendChildToElement
|
83
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_pyunicode)(const xmlChar *) = 0;
|
84
|
-
#define pyunicode __pyx_api_f_4lxml_5etree_pyunicode
|
85
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_utf8)(PyObject *) = 0;
|
86
|
-
#define utf8 __pyx_api_f_4lxml_5etree_utf8
|
87
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_getNsTag)(PyObject *) = 0;
|
88
|
-
#define getNsTag __pyx_api_f_4lxml_5etree_getNsTag
|
89
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs)(PyObject *) = 0;
|
90
|
-
#define getNsTagWithEmptyNs __pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs
|
91
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_namespacedName)(xmlNode *) = 0;
|
92
|
-
#define namespacedName __pyx_api_f_4lxml_5etree_namespacedName
|
93
|
-
static PyObject *(*__pyx_api_f_4lxml_5etree_namespacedNameFromNsName)(const xmlChar *, const xmlChar *) = 0;
|
94
|
-
#define namespacedNameFromNsName __pyx_api_f_4lxml_5etree_namespacedNameFromNsName
|
95
|
-
static void (*__pyx_api_f_4lxml_5etree_iteratorStoreNext)(struct LxmlElementIterator *, struct LxmlElement *) = 0;
|
96
|
-
#define iteratorStoreNext __pyx_api_f_4lxml_5etree_iteratorStoreNext
|
97
|
-
static void (*__pyx_api_f_4lxml_5etree_initTagMatch)(struct LxmlElementTagMatcher *, PyObject *) = 0;
|
98
|
-
#define initTagMatch __pyx_api_f_4lxml_5etree_initTagMatch
|
99
|
-
static xmlNs *(*__pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
100
|
-
#define findOrBuildNodeNsPrefix __pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
if (
|
152
|
-
if (
|
153
|
-
if (
|
154
|
-
if (
|
155
|
-
if (
|
156
|
-
if (
|
157
|
-
if (
|
158
|
-
if (
|
159
|
-
if (
|
160
|
-
if (
|
161
|
-
if (
|
162
|
-
if (
|
163
|
-
if (
|
164
|
-
if (
|
165
|
-
if (
|
166
|
-
if (
|
167
|
-
if (
|
168
|
-
if (
|
169
|
-
if (
|
170
|
-
if (
|
171
|
-
if (
|
172
|
-
if (
|
173
|
-
if (
|
174
|
-
if (
|
175
|
-
if (
|
176
|
-
if (
|
177
|
-
if (
|
178
|
-
if (
|
179
|
-
if (
|
180
|
-
if (
|
181
|
-
if (
|
182
|
-
if (
|
183
|
-
if (
|
184
|
-
if (
|
185
|
-
if (
|
186
|
-
if (
|
187
|
-
if (
|
188
|
-
|
189
|
-
|
190
|
-
bad
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
1
|
+
/* Generated by Cython 3.1.2 */
|
2
|
+
|
3
|
+
#ifndef __PYX_HAVE_API__lxml__etree
|
4
|
+
#define __PYX_HAVE_API__lxml__etree
|
5
|
+
#ifdef __MINGW64__
|
6
|
+
#define MS_WIN64
|
7
|
+
#endif
|
8
|
+
#include "Python.h"
|
9
|
+
#include "etree.h"
|
10
|
+
|
11
|
+
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_deepcopyNodeToDocument)(struct LxmlDocument *, xmlNode *) = 0;
|
12
|
+
#define deepcopyNodeToDocument __pyx_api_f_4lxml_5etree_deepcopyNodeToDocument
|
13
|
+
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_elementTreeFactory)(struct LxmlElement *) = 0;
|
14
|
+
#define elementTreeFactory __pyx_api_f_4lxml_5etree_elementTreeFactory
|
15
|
+
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_newElementTree)(struct LxmlElement *, PyObject *) = 0;
|
16
|
+
#define newElementTree __pyx_api_f_4lxml_5etree_newElementTree
|
17
|
+
static struct LxmlElementTree *(*__pyx_api_f_4lxml_5etree_adoptExternalDocument)(xmlDoc *, PyObject *, int) = 0;
|
18
|
+
#define adoptExternalDocument __pyx_api_f_4lxml_5etree_adoptExternalDocument
|
19
|
+
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_elementFactory)(struct LxmlDocument *, xmlNode *) = 0;
|
20
|
+
#define elementFactory __pyx_api_f_4lxml_5etree_elementFactory
|
21
|
+
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_makeElement)(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *) = 0;
|
22
|
+
#define makeElement __pyx_api_f_4lxml_5etree_makeElement
|
23
|
+
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_makeSubElement)(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *) = 0;
|
24
|
+
#define makeSubElement __pyx_api_f_4lxml_5etree_makeSubElement
|
25
|
+
static void (*__pyx_api_f_4lxml_5etree_setElementClassLookupFunction)(_element_class_lookup_function, PyObject *) = 0;
|
26
|
+
#define setElementClassLookupFunction __pyx_api_f_4lxml_5etree_setElementClassLookupFunction
|
27
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_lookupDefaultElementClass)(PyObject *, PyObject *, xmlNode *) = 0;
|
28
|
+
#define lookupDefaultElementClass __pyx_api_f_4lxml_5etree_lookupDefaultElementClass
|
29
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_lookupNamespaceElementClass)(PyObject *, PyObject *, xmlNode *) = 0;
|
30
|
+
#define lookupNamespaceElementClass __pyx_api_f_4lxml_5etree_lookupNamespaceElementClass
|
31
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_callLookupFallback)(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *) = 0;
|
32
|
+
#define callLookupFallback __pyx_api_f_4lxml_5etree_callLookupFallback
|
33
|
+
static int (*__pyx_api_f_4lxml_5etree_tagMatches)(xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
34
|
+
#define tagMatches __pyx_api_f_4lxml_5etree_tagMatches
|
35
|
+
static struct LxmlDocument *(*__pyx_api_f_4lxml_5etree_documentOrRaise)(PyObject *) = 0;
|
36
|
+
#define documentOrRaise __pyx_api_f_4lxml_5etree_documentOrRaise
|
37
|
+
static struct LxmlElement *(*__pyx_api_f_4lxml_5etree_rootNodeOrRaise)(PyObject *) = 0;
|
38
|
+
#define rootNodeOrRaise __pyx_api_f_4lxml_5etree_rootNodeOrRaise
|
39
|
+
static int (*__pyx_api_f_4lxml_5etree_hasText)(xmlNode *) = 0;
|
40
|
+
#define hasText __pyx_api_f_4lxml_5etree_hasText
|
41
|
+
static int (*__pyx_api_f_4lxml_5etree_hasTail)(xmlNode *) = 0;
|
42
|
+
#define hasTail __pyx_api_f_4lxml_5etree_hasTail
|
43
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_textOf)(xmlNode *) = 0;
|
44
|
+
#define textOf __pyx_api_f_4lxml_5etree_textOf
|
45
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_tailOf)(xmlNode *) = 0;
|
46
|
+
#define tailOf __pyx_api_f_4lxml_5etree_tailOf
|
47
|
+
static int (*__pyx_api_f_4lxml_5etree_setNodeText)(xmlNode *, PyObject *) = 0;
|
48
|
+
#define setNodeText __pyx_api_f_4lxml_5etree_setNodeText
|
49
|
+
static int (*__pyx_api_f_4lxml_5etree_setTailText)(xmlNode *, PyObject *) = 0;
|
50
|
+
#define setTailText __pyx_api_f_4lxml_5etree_setTailText
|
51
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_attributeValue)(xmlNode *, xmlAttr *) = 0;
|
52
|
+
#define attributeValue __pyx_api_f_4lxml_5etree_attributeValue
|
53
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_attributeValueFromNsName)(xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
54
|
+
#define attributeValueFromNsName __pyx_api_f_4lxml_5etree_attributeValueFromNsName
|
55
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_getAttributeValue)(struct LxmlElement *, PyObject *, PyObject *) = 0;
|
56
|
+
#define getAttributeValue __pyx_api_f_4lxml_5etree_getAttributeValue
|
57
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_iterattributes)(struct LxmlElement *, int) = 0;
|
58
|
+
#define iterattributes __pyx_api_f_4lxml_5etree_iterattributes
|
59
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_collectAttributes)(xmlNode *, int) = 0;
|
60
|
+
#define collectAttributes __pyx_api_f_4lxml_5etree_collectAttributes
|
61
|
+
static int (*__pyx_api_f_4lxml_5etree_setAttributeValue)(struct LxmlElement *, PyObject *, PyObject *) = 0;
|
62
|
+
#define setAttributeValue __pyx_api_f_4lxml_5etree_setAttributeValue
|
63
|
+
static int (*__pyx_api_f_4lxml_5etree_delAttribute)(struct LxmlElement *, PyObject *) = 0;
|
64
|
+
#define delAttribute __pyx_api_f_4lxml_5etree_delAttribute
|
65
|
+
static int (*__pyx_api_f_4lxml_5etree_delAttributeFromNsName)(xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
66
|
+
#define delAttributeFromNsName __pyx_api_f_4lxml_5etree_delAttributeFromNsName
|
67
|
+
static int (*__pyx_api_f_4lxml_5etree_hasChild)(xmlNode *) = 0;
|
68
|
+
#define hasChild __pyx_api_f_4lxml_5etree_hasChild
|
69
|
+
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChild)(xmlNode *, Py_ssize_t) = 0;
|
70
|
+
#define findChild __pyx_api_f_4lxml_5etree_findChild
|
71
|
+
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChildForwards)(xmlNode *, Py_ssize_t) = 0;
|
72
|
+
#define findChildForwards __pyx_api_f_4lxml_5etree_findChildForwards
|
73
|
+
static xmlNode *(*__pyx_api_f_4lxml_5etree_findChildBackwards)(xmlNode *, Py_ssize_t) = 0;
|
74
|
+
#define findChildBackwards __pyx_api_f_4lxml_5etree_findChildBackwards
|
75
|
+
static xmlNode *(*__pyx_api_f_4lxml_5etree_nextElement)(xmlNode *) = 0;
|
76
|
+
#define nextElement __pyx_api_f_4lxml_5etree_nextElement
|
77
|
+
static xmlNode *(*__pyx_api_f_4lxml_5etree_previousElement)(xmlNode *) = 0;
|
78
|
+
#define previousElement __pyx_api_f_4lxml_5etree_previousElement
|
79
|
+
static void (*__pyx_api_f_4lxml_5etree_appendChild)(struct LxmlElement *, struct LxmlElement *) = 0;
|
80
|
+
#define appendChild __pyx_api_f_4lxml_5etree_appendChild
|
81
|
+
static int (*__pyx_api_f_4lxml_5etree_appendChildToElement)(struct LxmlElement *, struct LxmlElement *) = 0;
|
82
|
+
#define appendChildToElement __pyx_api_f_4lxml_5etree_appendChildToElement
|
83
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_pyunicode)(const xmlChar *) = 0;
|
84
|
+
#define pyunicode __pyx_api_f_4lxml_5etree_pyunicode
|
85
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_utf8)(PyObject *) = 0;
|
86
|
+
#define utf8 __pyx_api_f_4lxml_5etree_utf8
|
87
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_getNsTag)(PyObject *) = 0;
|
88
|
+
#define getNsTag __pyx_api_f_4lxml_5etree_getNsTag
|
89
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs)(PyObject *) = 0;
|
90
|
+
#define getNsTagWithEmptyNs __pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs
|
91
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_namespacedName)(xmlNode *) = 0;
|
92
|
+
#define namespacedName __pyx_api_f_4lxml_5etree_namespacedName
|
93
|
+
static PyObject *(*__pyx_api_f_4lxml_5etree_namespacedNameFromNsName)(const xmlChar *, const xmlChar *) = 0;
|
94
|
+
#define namespacedNameFromNsName __pyx_api_f_4lxml_5etree_namespacedNameFromNsName
|
95
|
+
static void (*__pyx_api_f_4lxml_5etree_iteratorStoreNext)(struct LxmlElementIterator *, struct LxmlElement *) = 0;
|
96
|
+
#define iteratorStoreNext __pyx_api_f_4lxml_5etree_iteratorStoreNext
|
97
|
+
static void (*__pyx_api_f_4lxml_5etree_initTagMatch)(struct LxmlElementTagMatcher *, PyObject *) = 0;
|
98
|
+
#define initTagMatch __pyx_api_f_4lxml_5etree_initTagMatch
|
99
|
+
static xmlNs *(*__pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
100
|
+
#define findOrBuildNodeNsPrefix __pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix
|
101
|
+
static int __Pyx_ImportFunction_3_1_2(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
|
102
|
+
|
103
|
+
#ifndef __PYX_HAVE_RT_ImportFunction_3_1_2
|
104
|
+
#define __PYX_HAVE_RT_ImportFunction_3_1_2
|
105
|
+
static int __Pyx_ImportFunction_3_1_2(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
|
106
|
+
PyObject *d = 0;
|
107
|
+
PyObject *cobj = 0;
|
108
|
+
union {
|
109
|
+
void (*fp)(void);
|
110
|
+
void *p;
|
111
|
+
} tmp;
|
112
|
+
d = PyObject_GetAttrString(module, "__pyx_capi__");
|
113
|
+
if (!d)
|
114
|
+
goto bad;
|
115
|
+
#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000)
|
116
|
+
PyDict_GetItemStringRef(d, funcname, &cobj);
|
117
|
+
#else
|
118
|
+
cobj = PyDict_GetItemString(d, funcname);
|
119
|
+
Py_XINCREF(cobj);
|
120
|
+
#endif
|
121
|
+
if (!cobj) {
|
122
|
+
PyErr_Format(PyExc_ImportError,
|
123
|
+
"%.200s does not export expected C function %.200s",
|
124
|
+
PyModule_GetName(module), funcname);
|
125
|
+
goto bad;
|
126
|
+
}
|
127
|
+
if (!PyCapsule_IsValid(cobj, sig)) {
|
128
|
+
PyErr_Format(PyExc_TypeError,
|
129
|
+
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
|
130
|
+
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
|
131
|
+
goto bad;
|
132
|
+
}
|
133
|
+
tmp.p = PyCapsule_GetPointer(cobj, sig);
|
134
|
+
*f = tmp.fp;
|
135
|
+
if (!(*f))
|
136
|
+
goto bad;
|
137
|
+
Py_DECREF(d);
|
138
|
+
Py_DECREF(cobj);
|
139
|
+
return 0;
|
140
|
+
bad:
|
141
|
+
Py_XDECREF(d);
|
142
|
+
Py_XDECREF(cobj);
|
143
|
+
return -1;
|
144
|
+
}
|
145
|
+
#endif
|
146
|
+
|
147
|
+
|
148
|
+
static int import_lxml__etree(void) {
|
149
|
+
PyObject *module = 0;
|
150
|
+
module = PyImport_ImportModule("lxml.etree");
|
151
|
+
if (!module) goto bad;
|
152
|
+
if (__Pyx_ImportFunction_3_1_2(module, "deepcopyNodeToDocument", (void (**)(void))&__pyx_api_f_4lxml_5etree_deepcopyNodeToDocument, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad;
|
153
|
+
if (__Pyx_ImportFunction_3_1_2(module, "elementTreeFactory", (void (**)(void))&__pyx_api_f_4lxml_5etree_elementTreeFactory, "struct LxmlElementTree *(struct LxmlElement *)") < 0) goto bad;
|
154
|
+
if (__Pyx_ImportFunction_3_1_2(module, "newElementTree", (void (**)(void))&__pyx_api_f_4lxml_5etree_newElementTree, "struct LxmlElementTree *(struct LxmlElement *, PyObject *)") < 0) goto bad;
|
155
|
+
if (__Pyx_ImportFunction_3_1_2(module, "adoptExternalDocument", (void (**)(void))&__pyx_api_f_4lxml_5etree_adoptExternalDocument, "struct LxmlElementTree *(xmlDoc *, PyObject *, int)") < 0) goto bad;
|
156
|
+
if (__Pyx_ImportFunction_3_1_2(module, "elementFactory", (void (**)(void))&__pyx_api_f_4lxml_5etree_elementFactory, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad;
|
157
|
+
if (__Pyx_ImportFunction_3_1_2(module, "makeElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_makeElement, "struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad;
|
158
|
+
if (__Pyx_ImportFunction_3_1_2(module, "makeSubElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_makeSubElement, "struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad;
|
159
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setElementClassLookupFunction", (void (**)(void))&__pyx_api_f_4lxml_5etree_setElementClassLookupFunction, "void (_element_class_lookup_function, PyObject *)") < 0) goto bad;
|
160
|
+
if (__Pyx_ImportFunction_3_1_2(module, "lookupDefaultElementClass", (void (**)(void))&__pyx_api_f_4lxml_5etree_lookupDefaultElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad;
|
161
|
+
if (__Pyx_ImportFunction_3_1_2(module, "lookupNamespaceElementClass", (void (**)(void))&__pyx_api_f_4lxml_5etree_lookupNamespaceElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad;
|
162
|
+
if (__Pyx_ImportFunction_3_1_2(module, "callLookupFallback", (void (**)(void))&__pyx_api_f_4lxml_5etree_callLookupFallback, "PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)") < 0) goto bad;
|
163
|
+
if (__Pyx_ImportFunction_3_1_2(module, "tagMatches", (void (**)(void))&__pyx_api_f_4lxml_5etree_tagMatches, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
164
|
+
if (__Pyx_ImportFunction_3_1_2(module, "documentOrRaise", (void (**)(void))&__pyx_api_f_4lxml_5etree_documentOrRaise, "struct LxmlDocument *(PyObject *)") < 0) goto bad;
|
165
|
+
if (__Pyx_ImportFunction_3_1_2(module, "rootNodeOrRaise", (void (**)(void))&__pyx_api_f_4lxml_5etree_rootNodeOrRaise, "struct LxmlElement *(PyObject *)") < 0) goto bad;
|
166
|
+
if (__Pyx_ImportFunction_3_1_2(module, "hasText", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasText, "int (xmlNode *)") < 0) goto bad;
|
167
|
+
if (__Pyx_ImportFunction_3_1_2(module, "hasTail", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasTail, "int (xmlNode *)") < 0) goto bad;
|
168
|
+
if (__Pyx_ImportFunction_3_1_2(module, "textOf", (void (**)(void))&__pyx_api_f_4lxml_5etree_textOf, "PyObject *(xmlNode *)") < 0) goto bad;
|
169
|
+
if (__Pyx_ImportFunction_3_1_2(module, "tailOf", (void (**)(void))&__pyx_api_f_4lxml_5etree_tailOf, "PyObject *(xmlNode *)") < 0) goto bad;
|
170
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setNodeText", (void (**)(void))&__pyx_api_f_4lxml_5etree_setNodeText, "int (xmlNode *, PyObject *)") < 0) goto bad;
|
171
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setTailText", (void (**)(void))&__pyx_api_f_4lxml_5etree_setTailText, "int (xmlNode *, PyObject *)") < 0) goto bad;
|
172
|
+
if (__Pyx_ImportFunction_3_1_2(module, "attributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_attributeValue, "PyObject *(xmlNode *, xmlAttr *)") < 0) goto bad;
|
173
|
+
if (__Pyx_ImportFunction_3_1_2(module, "attributeValueFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_attributeValueFromNsName, "PyObject *(xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
174
|
+
if (__Pyx_ImportFunction_3_1_2(module, "getAttributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_getAttributeValue, "PyObject *(struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad;
|
175
|
+
if (__Pyx_ImportFunction_3_1_2(module, "iterattributes", (void (**)(void))&__pyx_api_f_4lxml_5etree_iterattributes, "PyObject *(struct LxmlElement *, int)") < 0) goto bad;
|
176
|
+
if (__Pyx_ImportFunction_3_1_2(module, "collectAttributes", (void (**)(void))&__pyx_api_f_4lxml_5etree_collectAttributes, "PyObject *(xmlNode *, int)") < 0) goto bad;
|
177
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setAttributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_setAttributeValue, "int (struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad;
|
178
|
+
if (__Pyx_ImportFunction_3_1_2(module, "delAttribute", (void (**)(void))&__pyx_api_f_4lxml_5etree_delAttribute, "int (struct LxmlElement *, PyObject *)") < 0) goto bad;
|
179
|
+
if (__Pyx_ImportFunction_3_1_2(module, "delAttributeFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_delAttributeFromNsName, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
180
|
+
if (__Pyx_ImportFunction_3_1_2(module, "hasChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasChild, "int (xmlNode *)") < 0) goto bad;
|
181
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChild, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad;
|
182
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findChildForwards", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChildForwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad;
|
183
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findChildBackwards", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChildBackwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad;
|
184
|
+
if (__Pyx_ImportFunction_3_1_2(module, "nextElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_nextElement, "xmlNode *(xmlNode *)") < 0) goto bad;
|
185
|
+
if (__Pyx_ImportFunction_3_1_2(module, "previousElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_previousElement, "xmlNode *(xmlNode *)") < 0) goto bad;
|
186
|
+
if (__Pyx_ImportFunction_3_1_2(module, "appendChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_appendChild, "void (struct LxmlElement *, struct LxmlElement *)") < 0) goto bad;
|
187
|
+
if (__Pyx_ImportFunction_3_1_2(module, "appendChildToElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_appendChildToElement, "int (struct LxmlElement *, struct LxmlElement *)") < 0) goto bad;
|
188
|
+
if (__Pyx_ImportFunction_3_1_2(module, "pyunicode", (void (**)(void))&__pyx_api_f_4lxml_5etree_pyunicode, "PyObject *(const xmlChar *)") < 0) goto bad;
|
189
|
+
if (__Pyx_ImportFunction_3_1_2(module, "utf8", (void (**)(void))&__pyx_api_f_4lxml_5etree_utf8, "PyObject *(PyObject *)") < 0) goto bad;
|
190
|
+
if (__Pyx_ImportFunction_3_1_2(module, "getNsTag", (void (**)(void))&__pyx_api_f_4lxml_5etree_getNsTag, "PyObject *(PyObject *)") < 0) goto bad;
|
191
|
+
if (__Pyx_ImportFunction_3_1_2(module, "getNsTagWithEmptyNs", (void (**)(void))&__pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs, "PyObject *(PyObject *)") < 0) goto bad;
|
192
|
+
if (__Pyx_ImportFunction_3_1_2(module, "namespacedName", (void (**)(void))&__pyx_api_f_4lxml_5etree_namespacedName, "PyObject *(xmlNode *)") < 0) goto bad;
|
193
|
+
if (__Pyx_ImportFunction_3_1_2(module, "namespacedNameFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_namespacedNameFromNsName, "PyObject *(const xmlChar *, const xmlChar *)") < 0) goto bad;
|
194
|
+
if (__Pyx_ImportFunction_3_1_2(module, "iteratorStoreNext", (void (**)(void))&__pyx_api_f_4lxml_5etree_iteratorStoreNext, "void (struct LxmlElementIterator *, struct LxmlElement *)") < 0) goto bad;
|
195
|
+
if (__Pyx_ImportFunction_3_1_2(module, "initTagMatch", (void (**)(void))&__pyx_api_f_4lxml_5etree_initTagMatch, "void (struct LxmlElementTagMatcher *, PyObject *)") < 0) goto bad;
|
196
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findOrBuildNodeNsPrefix", (void (**)(void))&__pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix, "xmlNs *(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
197
|
+
Py_DECREF(module); module = 0;
|
198
|
+
return 0;
|
199
|
+
bad:
|
200
|
+
Py_XDECREF(module);
|
201
|
+
return -1;
|
202
|
+
}
|
203
|
+
|
204
|
+
#endif /* !__PYX_HAVE_API__lxml__etree */
|
lxml/extensions.pxi
CHANGED
@@ -42,12 +42,9 @@ cdef class _BaseContext:
|
|
42
42
|
cdef _ExceptionContext _exc
|
43
43
|
cdef _ErrorLog _error_log
|
44
44
|
|
45
|
-
def __cinit__(self):
|
46
|
-
self._xpathCtxt = NULL
|
47
|
-
|
48
45
|
def __init__(self, namespaces, extensions, error_log, enable_regexp,
|
49
46
|
build_smart_strings):
|
50
|
-
cdef _ExsltRegExp _regexp
|
47
|
+
cdef _ExsltRegExp _regexp
|
51
48
|
cdef dict new_extensions
|
52
49
|
cdef list ns
|
53
50
|
self._utf_refs = {}
|
@@ -213,11 +210,11 @@ cdef class _BaseContext:
|
|
213
210
|
xpath.xmlXPathRegisterNs(self._xpathCtxt,
|
214
211
|
_xcstr(prefix_utf), NULL)
|
215
212
|
del self._global_namespaces[:]
|
216
|
-
|
213
|
+
|
217
214
|
cdef void _unregisterNamespace(self, prefix_utf) noexcept:
|
218
215
|
xpath.xmlXPathRegisterNs(self._xpathCtxt,
|
219
216
|
_xcstr(prefix_utf), NULL)
|
220
|
-
|
217
|
+
|
221
218
|
# extension functions
|
222
219
|
|
223
220
|
cdef int _addLocalExtensionFunction(self, ns_utf, name_utf, function) except -1:
|
lxml/html/__init__.py
CHANGED
@@ -70,7 +70,7 @@ _forms_xpath = etree.XPath("descendant-or-self::form|descendant-or-self::x:form"
|
|
70
70
|
#_class_xpath = etree.XPath(r"descendant-or-self::*[regexp:match(@class, concat('\b', $class_name, '\b'))]", {'regexp': 'http://exslt.org/regular-expressions'})
|
71
71
|
_class_xpath = etree.XPath("descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), concat(' ', $class_name, ' '))]")
|
72
72
|
_id_xpath = etree.XPath("descendant-or-self::*[@id=$id]")
|
73
|
-
_collect_string_content = etree.XPath("string()")
|
73
|
+
_collect_string_content = etree.XPath("string()", smart_strings=False)
|
74
74
|
_iter_css_urls = re.compile(r'url\(('+'["][^"]*["]|'+"['][^']*[']|"+r'[^)]*)\)', re.I).finditer
|
75
75
|
_iter_css_imports = re.compile(r'@import "(.*?)"').finditer
|
76
76
|
_label_xpath = etree.XPath("//label[@for=$id]|//x:label[@for=$id]",
|
@@ -263,7 +263,9 @@ class HtmlMixin:
|
|
263
263
|
Return the <body> element. Can be called from a child element
|
264
264
|
to get the document's head.
|
265
265
|
"""
|
266
|
-
|
266
|
+
for element in self.getroottree().iter("body", f"{{{XHTML_NAMESPACE}}}body"):
|
267
|
+
return element
|
268
|
+
return None
|
267
269
|
|
268
270
|
@property
|
269
271
|
def head(self):
|
@@ -271,7 +273,9 @@ class HtmlMixin:
|
|
271
273
|
Returns the <head> element. Can be called from a child
|
272
274
|
element to get the document's head.
|
273
275
|
"""
|
274
|
-
|
276
|
+
for element in self.getroottree().iter("head", f"{{{XHTML_NAMESPACE}}}head"):
|
277
|
+
return element
|
278
|
+
return None
|
275
279
|
|
276
280
|
@property
|
277
281
|
def label(self):
|
Binary file
|