![](https://secure.gravatar.com/avatar/1a2495493e0166d41f6cae64ed6f29ea.jpg?s=120&d=mm&r=g)
I just created the following Bob1.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="root"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Ready for English peer review"/> <xs:enumeration value="Ready for English scientific review"/> <xs:enumeration value="Ready for English OCCM review"/> <xs:enumeration value="Ready for Spanish peer review"/> <xs:enumeration value="Ready for Spanish OCCM review"/> <xs:enumeration value="Ready for publishing"/> <xs:enumeration value="Ready for translation"/> <xs:enumeration value="Processing complete"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:schema> Bob1.xml <?xml version="1.0" encoding="UTF-8"?> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="scema1.xsd">Processing complete</root> .. with a CR after 'Processing' and the command "xmllint --schema Bob1.xsd Bob1.xml" fails with the message...
xmllint --schema schema1.xsd doc1.xml <?xml version="1.0" encoding="UTF-8"?> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="scema1.xsd">Processing complete</root> doc1.xml:2: element root: Schemas validity error : Element 'root': [facet 'enumeration'] The value 'Processing complete' is not an element of the set {'Ready for English peer review', 'Ready for English scientific review', 'Ready for English OCCM review', 'Ready for Spanish peer review', 'Ready for Spanish OCCM review', 'Ready for publishing', 'Ready for translation', 'Processing complete'}. doc1.xml:2: element root: Schemas validity error : Element 'root': 'Processing complete' is not a valid value of the local atomic type. doc1.xml fails to validate
I will look into the libxml2 to see where the \n is being converted to a <space>. Paul -----Original Message----- From: Stefan Behnel <stefan_ml@behnel.de> Sent: 02 May 2021 18:28 To: lxml@python.org Subject: [lxml] Re: Tested value modified in validation error message Hi, Bob Kline schrieb am 02.05.21 um 18:56:
The bug I'm asking about in this forum is the second bug, which is producing an incorrect error message, pretending that the value being submitted for testing was "Processing complete" (without a newline character) when the value being tested was actually "Processing\ncomplete" (with a newline character). The confusion this misleading error message introduced made it much more difficult than it should have been to track down and identify the first bug.
It might be that there is some form of space normalisation going on here. In any case, it's not lxml that comes up with this message but libxml2. (In which case this is the wrong place to report this.) You can check whether the "xmllint" tool (that comes with libxml2 as a frontend) shows the same behaviour when you run its XML-Schema validation. Note that lxml probably uses the latest libxml2 on your side (the wheels include it), which may not be same as the library version installed on your system. Stefan _______________________________________________ lxml - The Python XML Toolkit mailing list -- lxml@python.org To unsubscribe send an email to lxml-leave@python.org https://mail.python.org/mailman3/lists/lxml.python.org/ Member address: paul_higgs@hotmail.com