Actions
Bug #6475
closedsaxoncee.PySaxonApiError: Source document not found. Line number: -1
Start date:
2024-07-09
Due date:
% Done:
0%
Estimated time:
Applies to branch:
Fix Committed on Branch:
12
Fixed in Maintenance Release:
Found in version:
12.5
Fixed in version:
SaxonC Languages:
C++, PHP, Python
SaxonC Platforms:
All
SaxonC Architecture:
Description
The Python PySchemaValidator is failing to validate an XML document if supplied as an XdmNode.
For example the following script:
invalid_xml = "<?xml version='1.0'?><request><a/><!--comment--></request>"
sch1 = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' elementFormDefault='qualified' attributeFormDefault='unqualified'><xs:element name='request'><xs:complexType><xs:sequence><xs:element name='a' type='xs:string'/><xs:element name='b' type='xs:string'/></xs:sequence><xs:assert test='count(child::node()) = 3'/></xs:complexType></xs:element></xs:schema>"
input_ = saxonproc2.parse_xml(xml_text=invalid_xml)
print(type(input_))
val.set_source_node(input_)
val.register_schema(xsd_text=sch1)
val.validate()
Throws the exception:
saxoncee.PySaxonApiError: Source document not found. Line number: -1
The workaround is supply the XML document as a file using the file_name
keyword argument.
This worked in SaxonC 12.4.2.
Related issues
Please register to edit this issue
Actions