You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue where I am unable to encode an XSD enumeration which utilizes namespaces (which had just been decoded). The code complains that s:Sender must belong to a set of values, but this set of values includes {http://www.w3.org/2003/05/soap-envelope}Sender. The xml as shown by the error has the namespace xmlns:s="http://www.w3.org/2003/05/soap-envelope". As a side-note the .xsd schema file denotes this namespace by tns rather than s.
File "/home/garming/.local/lib/python3.10/site-packages/xmlschema/validators/groups.py", line 1198, in iter_encode
for result in xsd_element.iter_encode(value, validation, **kwargs):
File "/home/garming/.local/lib/python3.10/site-packages/xmlschema/validators/elements.py", line 1080, in iter_encode
yield self.validation_error(validation, e, elem, **kwargs)
File "/home/garming/.local/lib/python3.10/site-packages/xmlschema/validators/xsdbase.py", line 249, in validation_error
raise error
File "/home/garming/.local/lib/python3.10/site-packages/xmlschema/validators/simple_types.py", line 1475, in iter_encode
validator(obj)
File "/home/garming/.local/lib/python3.10/site-packages/xmlschema/validators/facets.py", line 633, in __call__
raise XMLSchemaValidationError(self, value, reason)
xmlschema.validators.exceptions.XMLSchemaValidationError: failed validating 's:Sender' with XsdEnumerationFacets(['{http://www.w3.org/2003/05/soap-envelope}DataEncodingUnknown', '{http://www.w3.org/2003/05/soap-envelope}MustUnderstand', '{http://www.w3.org/2003/05/soap-envelope}Receiver', '{http://www.w3.org/2003/05/soap-envelope}Sender', '{http://www.w3.org/2003/05/soap-envelope}VersionMismatch']):
Reason: value must be one of ['{http://www.w3.org/2003/05/soap-envelope}DataEncodingUnknown', '{http://www.w3.org/2003/05/soap-envelope}MustUnderstand', '{http://www.w3.org/2003/05/soap-envelope}Receiver', '{http://www.w3.org/2003/05/soap-envelope}Sender', '{http://www.w3.org/2003/05/soap-envelope}VersionMismatch']
Schema component:
<xs:enumeration xmlns:xs="http://www.w3.org/2001/XMLSchema" value="tns:DataEncodingUnknown" />
Instance type: <class 'xml.etree.ElementTree.Element'>
Instance:
<s:Value xmlns:s="http://www.w3.org/2003/05/soap-envelope">s:Sender</s:Value>
The text was updated successfully, but these errors were encountered:
Hi,
the XSD enumeration has a xs:QName as base type, so prefixed values have to be converted to expanded form (the prefix can change ...).
The fix for this is to provide the expanded form to facets validators in case of type derived from xs:QName or xs:NOTATION also during the encode phase:
Hi, release v3.4.2 with the latest release of elementpath should resolve the encoding of QNames (by improving the decode of XSD datatypes and taking the namespace information from the element nodes).
Version: xmlschema 3.3.1
I encountered an issue where I am unable to encode an XSD enumeration which utilizes namespaces (which had just been decoded). The code complains that
s:Sender
must belong to a set of values, but this set of values includes{http://www.w3.org/2003/05/soap-envelope}Sender
. The xml as shown by the error has the namespacexmlns:s="http://www.w3.org/2003/05/soap-envelope"
. As a side-note the .xsd schema file denotes this namespace bytns
rather thans
.The text was updated successfully, but these errors were encountered: