Hi Bob

If the input is "Processing\ncomplete" and the match string is "Processing 
complete" then this will not be a match, but if your enumeration value is 
"Pattern\scomplete" it should be OK (and it will also match "Pattern complete"(.
(I guess the "sometimes garbles whitespace inside text nodes" is just the 
commercial XML editor wrapping lines that could exceed a 'pretty' length.

Paul

-----Original Message-----
From: Bob Kline <[email protected]> 
Sent: 02 May 2021 13:32
To: lxml mailing list <[email protected]>
Subject: [lxml] Tested value modified in validation error message

Before I file a ticket, I wanted to check here to find out if this is a known 
problem (I searched the bug tracker, but didn't see any matches).

Our customer is using a commercial XML editor and the editor's implementation 
of the DOM API sometimes garbles whitespace inside text nodes when serializing 
XML documents for the document's xml property.
This causes schema validation errors when we send that serialization off to be 
validated against the document type's schema using lxml. The problem we have 
run into with lxml is that the message property of the error object which comes 
back in the schema object's error_log has altered the value being validated. 
So, for example, if the text content of an element in the serialized DOM is 
"Processing\ncomplete"
and the value it was supposed to match in the enumerated valid values is 
"Processing complete" then the message attribute for the corresponding object 
in the error_log has

Element 'ProcessingStatusValue': [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'}.

In effect saying "the value 'Processing complete' does not match the value 
'Processing complete'."

Took a very long time for us to figure out that the error message was wrong, 
and that it should have said

... The value 'Processing\ncomplete' is not an element of the set ....

--
Bob Kline
https://www.rksystems.com
mailto:[email protected]
_______________________________________________
lxml - The Python XML Toolkit mailing list -- [email protected] To unsubscribe 
send an email to [email protected] 
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: [email protected]
_______________________________________________
lxml - The Python XML Toolkit mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: [email protected]

Reply via email to