lxml 5.2.0__cp310-cp310-win32.whl → 5.2.2__cp310-cp310-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 (89) hide show
  1. lxml/ElementInclude.py +244 -244
  2. lxml/__init__.py +22 -22
  3. lxml/_elementpath.cp310-win32.pyd +0 -0
  4. lxml/_elementpath.py +341 -341
  5. lxml/apihelpers.pxi +1793 -1793
  6. lxml/builder.cp310-win32.pyd +0 -0
  7. lxml/builder.py +232 -232
  8. lxml/classlookup.pxi +580 -580
  9. lxml/cleanup.pxi +215 -215
  10. lxml/cssselect.py +101 -101
  11. lxml/debug.pxi +90 -90
  12. lxml/docloader.pxi +178 -178
  13. lxml/doctestcompare.py +488 -488
  14. lxml/dtd.pxi +478 -478
  15. lxml/etree.cp310-win32.pyd +0 -0
  16. lxml/etree.h +6 -6
  17. lxml/etree.pyx +3732 -3711
  18. lxml/extensions.pxi +833 -833
  19. lxml/html/ElementSoup.py +10 -10
  20. lxml/html/__init__.py +1923 -1923
  21. lxml/html/_diffcommand.py +86 -86
  22. lxml/html/_html5builder.py +100 -100
  23. lxml/html/_setmixin.py +56 -56
  24. lxml/html/builder.py +133 -133
  25. lxml/html/clean.py +21 -21
  26. lxml/html/defs.py +135 -135
  27. lxml/html/diff.cp310-win32.pyd +0 -0
  28. lxml/html/diff.py +878 -878
  29. lxml/html/formfill.py +299 -299
  30. lxml/html/html5parser.py +260 -260
  31. lxml/html/soupparser.py +314 -314
  32. lxml/html/usedoctest.py +13 -13
  33. lxml/includes/c14n.pxd +25 -25
  34. lxml/includes/config.pxd +3 -3
  35. lxml/includes/dtdvalid.pxd +18 -18
  36. lxml/includes/etree_defs.h +379 -379
  37. lxml/includes/etreepublic.pxd +237 -237
  38. lxml/includes/htmlparser.pxd +56 -56
  39. lxml/includes/lxml-version.h +1 -1
  40. lxml/includes/relaxng.pxd +64 -64
  41. lxml/includes/schematron.pxd +34 -34
  42. lxml/includes/tree.pxd +494 -494
  43. lxml/includes/uri.pxd +5 -5
  44. lxml/includes/xinclude.pxd +22 -22
  45. lxml/includes/xmlerror.pxd +852 -852
  46. lxml/includes/xmlparser.pxd +265 -265
  47. lxml/includes/xmlschema.pxd +35 -35
  48. lxml/includes/xpath.pxd +136 -136
  49. lxml/includes/xslt.pxd +190 -190
  50. lxml/isoschematron/__init__.py +348 -348
  51. lxml/isoschematron/resources/rng/iso-schematron.rng +709 -709
  52. lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl +75 -75
  53. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl +312 -312
  54. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl +1159 -1159
  55. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl +54 -54
  56. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1796 -1796
  57. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +588 -588
  58. lxml/iterparse.pxi +438 -438
  59. lxml/lxml.etree.h +6 -6
  60. lxml/nsclasses.pxi +281 -281
  61. lxml/objectify.cp310-win32.pyd +0 -0
  62. lxml/objectify.pyx +2145 -2145
  63. lxml/objectpath.pxi +332 -332
  64. lxml/parser.pxi +1994 -1994
  65. lxml/parsertarget.pxi +180 -180
  66. lxml/proxy.pxi +619 -619
  67. lxml/public-api.pxi +178 -178
  68. lxml/pyclasslookup.py +3 -3
  69. lxml/readonlytree.pxi +565 -565
  70. lxml/relaxng.pxi +165 -165
  71. lxml/sax.cp310-win32.pyd +0 -0
  72. lxml/sax.py +275 -275
  73. lxml/saxparser.pxi +875 -875
  74. lxml/schematron.pxi +168 -168
  75. lxml/serializer.pxi +1871 -1871
  76. lxml/usedoctest.py +13 -13
  77. lxml/xinclude.pxi +67 -67
  78. lxml/xmlerror.pxi +1654 -1654
  79. lxml/xmlid.pxi +179 -179
  80. lxml/xmlschema.pxi +215 -215
  81. lxml/xpath.pxi +487 -487
  82. lxml/xslt.pxi +950 -950
  83. lxml/xsltext.pxi +242 -242
  84. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/LICENSE.txt +29 -29
  85. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/LICENSES.txt +29 -29
  86. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/METADATA +9 -17
  87. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/RECORD +89 -89
  88. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/WHEEL +0 -0
  89. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/top_level.txt +0 -0
lxml/xmlschema.pxi CHANGED
@@ -1,215 +1,215 @@
1
- # support for XMLSchema validation
2
- from lxml.includes cimport xmlschema
3
-
4
-
5
- cdef class XMLSchemaError(LxmlError):
6
- """Base class of all XML Schema errors
7
- """
8
-
9
- cdef class XMLSchemaParseError(XMLSchemaError):
10
- """Error while parsing an XML document as XML Schema.
11
- """
12
-
13
- cdef class XMLSchemaValidateError(XMLSchemaError):
14
- """Error while validating an XML document with an XML Schema.
15
- """
16
-
17
-
18
- ################################################################################
19
- # XMLSchema
20
-
21
- cdef XPath _check_for_default_attributes = XPath(
22
- "boolean(//xs:attribute[@default or @fixed][1])",
23
- namespaces={'xs': 'http://www.w3.org/2001/XMLSchema'})
24
-
25
-
26
- cdef class XMLSchema(_Validator):
27
- """XMLSchema(self, etree=None, file=None)
28
- Turn a document into an XML Schema validator.
29
-
30
- Either pass a schema as Element or ElementTree, or pass a file or
31
- filename through the ``file`` keyword argument.
32
-
33
- Passing the ``attribute_defaults`` boolean option will make the
34
- schema insert default/fixed attributes into validated documents.
35
- """
36
- cdef xmlschema.xmlSchema* _c_schema
37
- cdef _Document _doc
38
- cdef bint _has_default_attributes
39
- cdef bint _add_attribute_defaults
40
-
41
- def __cinit__(self):
42
- self._has_default_attributes = True # play it safe
43
- self._add_attribute_defaults = False
44
-
45
- def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):
46
- cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
47
- cdef xmlDoc* c_doc
48
-
49
- self._add_attribute_defaults = attribute_defaults
50
- _Validator.__init__(self)
51
- c_doc = NULL
52
- if etree is not None:
53
- doc = _documentOrRaise(etree)
54
- root_node = _rootNodeOrRaise(etree)
55
- c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
56
- self._doc = _documentFactory(c_doc, doc._parser)
57
- parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
58
- elif file is not None:
59
- file = _getFSPathOrObject(file)
60
- if _isString(file):
61
- filename = _encodeFilename(file)
62
- parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
63
- else:
64
- self._doc = _parseDocument(file, None, None)
65
- parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)
66
- else:
67
- raise XMLSchemaParseError, "No tree or file given"
68
-
69
- if parser_ctxt is NULL:
70
- raise MemoryError()
71
-
72
- # Need a cast here because older libxml2 releases do not use 'const' in the functype.
73
- xmlschema.xmlSchemaSetParserStructuredErrors(
74
- parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
75
- if self._doc is not None:
76
- # calling xmlSchemaParse on a schema with imports or
77
- # includes will cause libxml2 to create an internal
78
- # context for parsing, so push an implied context to route
79
- # resolve requests to the document's parser
80
- __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
81
- with nogil:
82
- orig_loader = _register_document_loader()
83
- self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
84
- _reset_document_loader(orig_loader)
85
- if self._doc is not None:
86
- __GLOBAL_PARSER_CONTEXT.popImpliedContext()
87
- xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
88
-
89
- if self._c_schema is NULL:
90
- raise XMLSchemaParseError(
91
- self._error_log._buildExceptionMessage(
92
- "Document is not valid XML Schema"),
93
- self._error_log)
94
-
95
- if self._doc is not None:
96
- self._has_default_attributes = _check_for_default_attributes(self._doc)
97
- self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
98
-
99
- def __dealloc__(self):
100
- xmlschema.xmlSchemaFree(self._c_schema)
101
-
102
- def __call__(self, etree):
103
- """__call__(self, etree)
104
-
105
- Validate doc using XML Schema.
106
-
107
- Returns true if document is valid, false if not.
108
- """
109
- cdef xmlschema.xmlSchemaValidCtxt* valid_ctxt
110
- cdef _Document doc
111
- cdef _Element root_node
112
- cdef xmlDoc* c_doc
113
- cdef int ret
114
-
115
- assert self._c_schema is not NULL, "Schema instance not initialised"
116
- doc = _documentOrRaise(etree)
117
- root_node = _rootNodeOrRaise(etree)
118
-
119
- valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
120
- if valid_ctxt is NULL:
121
- raise MemoryError()
122
-
123
- try:
124
- if self._add_attribute_defaults:
125
- xmlschema.xmlSchemaSetValidOptions(
126
- valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
127
-
128
- self._error_log.clear()
129
- # Need a cast here because older libxml2 releases do not use 'const' in the functype.
130
- xmlschema.xmlSchemaSetValidStructuredErrors(
131
- valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
132
-
133
- c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
134
- with nogil:
135
- ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
136
- _destroyFakeDoc(doc._c_doc, c_doc)
137
- finally:
138
- xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
139
-
140
- if ret == -1:
141
- raise XMLSchemaValidateError(
142
- "Internal error in XML Schema validation.",
143
- self._error_log)
144
- if ret == 0:
145
- return True
146
- else:
147
- return False
148
-
149
- cdef _ParserSchemaValidationContext _newSaxValidator(
150
- self, bint add_default_attributes):
151
- cdef _ParserSchemaValidationContext context
152
- context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
153
- context._schema = self
154
- context._add_default_attributes = (self._has_default_attributes and (
155
- add_default_attributes or self._add_attribute_defaults))
156
- return context
157
-
158
- @cython.final
159
- @cython.internal
160
- cdef class _ParserSchemaValidationContext:
161
- cdef XMLSchema _schema
162
- cdef xmlschema.xmlSchemaValidCtxt* _valid_ctxt
163
- cdef xmlschema.xmlSchemaSAXPlugStruct* _sax_plug
164
- cdef bint _add_default_attributes
165
- def __cinit__(self):
166
- self._valid_ctxt = NULL
167
- self._sax_plug = NULL
168
- self._add_default_attributes = False
169
-
170
- def __dealloc__(self):
171
- self.disconnect()
172
- if self._valid_ctxt:
173
- xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
174
-
175
- cdef _ParserSchemaValidationContext copy(self):
176
- assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
177
- return self._schema._newSaxValidator(
178
- self._add_default_attributes)
179
-
180
- cdef void inject_default_attributes(self, xmlDoc* c_doc) noexcept:
181
- # we currently need to insert default attributes manually
182
- # after parsing, as libxml2 does not support this at parse
183
- # time
184
- if self._add_default_attributes:
185
- with nogil:
186
- xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
187
-
188
- cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
189
- if self._valid_ctxt is NULL:
190
- self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
191
- self._schema._c_schema)
192
- if self._valid_ctxt is NULL:
193
- raise MemoryError()
194
- if self._add_default_attributes:
195
- xmlschema.xmlSchemaSetValidOptions(
196
- self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
197
- if error_log is not None:
198
- # Need a cast here because older libxml2 releases do not use 'const' in the functype.
199
- xmlschema.xmlSchemaSetValidStructuredErrors(
200
- self._valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>error_log)
201
- self._sax_plug = xmlschema.xmlSchemaSAXPlug(
202
- self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
203
-
204
- cdef void disconnect(self) noexcept:
205
- if self._sax_plug is not NULL:
206
- xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
207
- self._sax_plug = NULL
208
- if self._valid_ctxt is not NULL:
209
- xmlschema.xmlSchemaSetValidStructuredErrors(
210
- self._valid_ctxt, NULL, NULL)
211
-
212
- cdef bint isvalid(self) noexcept:
213
- if self._valid_ctxt is NULL:
214
- return 1 # valid
215
- return xmlschema.xmlSchemaIsValid(self._valid_ctxt)
1
+ # support for XMLSchema validation
2
+ from lxml.includes cimport xmlschema
3
+
4
+
5
+ cdef class XMLSchemaError(LxmlError):
6
+ """Base class of all XML Schema errors
7
+ """
8
+
9
+ cdef class XMLSchemaParseError(XMLSchemaError):
10
+ """Error while parsing an XML document as XML Schema.
11
+ """
12
+
13
+ cdef class XMLSchemaValidateError(XMLSchemaError):
14
+ """Error while validating an XML document with an XML Schema.
15
+ """
16
+
17
+
18
+ ################################################################################
19
+ # XMLSchema
20
+
21
+ cdef XPath _check_for_default_attributes = XPath(
22
+ "boolean(//xs:attribute[@default or @fixed][1])",
23
+ namespaces={'xs': 'http://www.w3.org/2001/XMLSchema'})
24
+
25
+
26
+ cdef class XMLSchema(_Validator):
27
+ """XMLSchema(self, etree=None, file=None)
28
+ Turn a document into an XML Schema validator.
29
+
30
+ Either pass a schema as Element or ElementTree, or pass a file or
31
+ filename through the ``file`` keyword argument.
32
+
33
+ Passing the ``attribute_defaults`` boolean option will make the
34
+ schema insert default/fixed attributes into validated documents.
35
+ """
36
+ cdef xmlschema.xmlSchema* _c_schema
37
+ cdef _Document _doc
38
+ cdef bint _has_default_attributes
39
+ cdef bint _add_attribute_defaults
40
+
41
+ def __cinit__(self):
42
+ self._has_default_attributes = True # play it safe
43
+ self._add_attribute_defaults = False
44
+
45
+ def __init__(self, etree=None, *, file=None, bint attribute_defaults=False):
46
+ cdef xmlschema.xmlSchemaParserCtxt* parser_ctxt
47
+ cdef xmlDoc* c_doc
48
+
49
+ self._add_attribute_defaults = attribute_defaults
50
+ _Validator.__init__(self)
51
+ c_doc = NULL
52
+ if etree is not None:
53
+ doc = _documentOrRaise(etree)
54
+ root_node = _rootNodeOrRaise(etree)
55
+ c_doc = _copyDocRoot(doc._c_doc, root_node._c_node)
56
+ self._doc = _documentFactory(c_doc, doc._parser)
57
+ parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(c_doc)
58
+ elif file is not None:
59
+ file = _getFSPathOrObject(file)
60
+ if _isString(file):
61
+ filename = _encodeFilename(file)
62
+ parser_ctxt = xmlschema.xmlSchemaNewParserCtxt(_cstr(filename))
63
+ else:
64
+ self._doc = _parseDocument(file, None, None)
65
+ parser_ctxt = xmlschema.xmlSchemaNewDocParserCtxt(self._doc._c_doc)
66
+ else:
67
+ raise XMLSchemaParseError, "No tree or file given"
68
+
69
+ if parser_ctxt is NULL:
70
+ raise MemoryError()
71
+
72
+ # Need a cast here because older libxml2 releases do not use 'const' in the functype.
73
+ xmlschema.xmlSchemaSetParserStructuredErrors(
74
+ parser_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
75
+ if self._doc is not None:
76
+ # calling xmlSchemaParse on a schema with imports or
77
+ # includes will cause libxml2 to create an internal
78
+ # context for parsing, so push an implied context to route
79
+ # resolve requests to the document's parser
80
+ __GLOBAL_PARSER_CONTEXT.pushImpliedContextFromParser(self._doc._parser)
81
+ with nogil:
82
+ orig_loader = _register_document_loader()
83
+ self._c_schema = xmlschema.xmlSchemaParse(parser_ctxt)
84
+ _reset_document_loader(orig_loader)
85
+ if self._doc is not None:
86
+ __GLOBAL_PARSER_CONTEXT.popImpliedContext()
87
+ xmlschema.xmlSchemaFreeParserCtxt(parser_ctxt)
88
+
89
+ if self._c_schema is NULL:
90
+ raise XMLSchemaParseError(
91
+ self._error_log._buildExceptionMessage(
92
+ "Document is not valid XML Schema"),
93
+ self._error_log)
94
+
95
+ if self._doc is not None:
96
+ self._has_default_attributes = _check_for_default_attributes(self._doc)
97
+ self._add_attribute_defaults = attribute_defaults and self._has_default_attributes
98
+
99
+ def __dealloc__(self):
100
+ xmlschema.xmlSchemaFree(self._c_schema)
101
+
102
+ def __call__(self, etree):
103
+ """__call__(self, etree)
104
+
105
+ Validate doc using XML Schema.
106
+
107
+ Returns true if document is valid, false if not.
108
+ """
109
+ cdef xmlschema.xmlSchemaValidCtxt* valid_ctxt
110
+ cdef _Document doc
111
+ cdef _Element root_node
112
+ cdef xmlDoc* c_doc
113
+ cdef int ret
114
+
115
+ assert self._c_schema is not NULL, "Schema instance not initialised"
116
+ doc = _documentOrRaise(etree)
117
+ root_node = _rootNodeOrRaise(etree)
118
+
119
+ valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(self._c_schema)
120
+ if valid_ctxt is NULL:
121
+ raise MemoryError()
122
+
123
+ try:
124
+ if self._add_attribute_defaults:
125
+ xmlschema.xmlSchemaSetValidOptions(
126
+ valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
127
+
128
+ self._error_log.clear()
129
+ # Need a cast here because older libxml2 releases do not use 'const' in the functype.
130
+ xmlschema.xmlSchemaSetValidStructuredErrors(
131
+ valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>self._error_log)
132
+
133
+ c_doc = _fakeRootDoc(doc._c_doc, root_node._c_node)
134
+ with nogil:
135
+ ret = xmlschema.xmlSchemaValidateDoc(valid_ctxt, c_doc)
136
+ _destroyFakeDoc(doc._c_doc, c_doc)
137
+ finally:
138
+ xmlschema.xmlSchemaFreeValidCtxt(valid_ctxt)
139
+
140
+ if ret == -1:
141
+ raise XMLSchemaValidateError(
142
+ "Internal error in XML Schema validation.",
143
+ self._error_log)
144
+ if ret == 0:
145
+ return True
146
+ else:
147
+ return False
148
+
149
+ cdef _ParserSchemaValidationContext _newSaxValidator(
150
+ self, bint add_default_attributes):
151
+ cdef _ParserSchemaValidationContext context
152
+ context = _ParserSchemaValidationContext.__new__(_ParserSchemaValidationContext)
153
+ context._schema = self
154
+ context._add_default_attributes = (self._has_default_attributes and (
155
+ add_default_attributes or self._add_attribute_defaults))
156
+ return context
157
+
158
+ @cython.final
159
+ @cython.internal
160
+ cdef class _ParserSchemaValidationContext:
161
+ cdef XMLSchema _schema
162
+ cdef xmlschema.xmlSchemaValidCtxt* _valid_ctxt
163
+ cdef xmlschema.xmlSchemaSAXPlugStruct* _sax_plug
164
+ cdef bint _add_default_attributes
165
+ def __cinit__(self):
166
+ self._valid_ctxt = NULL
167
+ self._sax_plug = NULL
168
+ self._add_default_attributes = False
169
+
170
+ def __dealloc__(self):
171
+ self.disconnect()
172
+ if self._valid_ctxt:
173
+ xmlschema.xmlSchemaFreeValidCtxt(self._valid_ctxt)
174
+
175
+ cdef _ParserSchemaValidationContext copy(self):
176
+ assert self._schema is not None, "_ParserSchemaValidationContext not initialised"
177
+ return self._schema._newSaxValidator(
178
+ self._add_default_attributes)
179
+
180
+ cdef void inject_default_attributes(self, xmlDoc* c_doc) noexcept:
181
+ # we currently need to insert default attributes manually
182
+ # after parsing, as libxml2 does not support this at parse
183
+ # time
184
+ if self._add_default_attributes:
185
+ with nogil:
186
+ xmlschema.xmlSchemaValidateDoc(self._valid_ctxt, c_doc)
187
+
188
+ cdef int connect(self, xmlparser.xmlParserCtxt* c_ctxt, _BaseErrorLog error_log) except -1:
189
+ if self._valid_ctxt is NULL:
190
+ self._valid_ctxt = xmlschema.xmlSchemaNewValidCtxt(
191
+ self._schema._c_schema)
192
+ if self._valid_ctxt is NULL:
193
+ raise MemoryError()
194
+ if self._add_default_attributes:
195
+ xmlschema.xmlSchemaSetValidOptions(
196
+ self._valid_ctxt, xmlschema.XML_SCHEMA_VAL_VC_I_CREATE)
197
+ if error_log is not None:
198
+ # Need a cast here because older libxml2 releases do not use 'const' in the functype.
199
+ xmlschema.xmlSchemaSetValidStructuredErrors(
200
+ self._valid_ctxt, <xmlerror.xmlStructuredErrorFunc> _receiveError, <void*>error_log)
201
+ self._sax_plug = xmlschema.xmlSchemaSAXPlug(
202
+ self._valid_ctxt, &c_ctxt.sax, &c_ctxt.userData)
203
+
204
+ cdef void disconnect(self) noexcept:
205
+ if self._sax_plug is not NULL:
206
+ xmlschema.xmlSchemaSAXUnplug(self._sax_plug)
207
+ self._sax_plug = NULL
208
+ if self._valid_ctxt is not NULL:
209
+ xmlschema.xmlSchemaSetValidStructuredErrors(
210
+ self._valid_ctxt, NULL, NULL)
211
+
212
+ cdef bint isvalid(self) noexcept:
213
+ if self._valid_ctxt is NULL:
214
+ return 1 # valid
215
+ return xmlschema.xmlSchemaIsValid(self._valid_ctxt)