"xs:anyType" not properly handled (not base type of (e.g.) "xs:string")
Brought to you by:
pabigot
According to XML-schema, "anyType" is the common base type of both simple as well as complex types, especially the base type of "xs:string".
SAML2 ("http://docs.oasis-open.org/security/saml/v2.0/saml-schema-assertion-2.0.xsd") uses "xs:anyType" in the definition of its "AttributeValue" element. Examples show that
<AttributeValue xmlns="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">123</AttributeValue>
is a legal XML document describing an "AttributeValue".
Calling "CreateFromDocument" on this document results in
File ".../pyxb/binding/saxer.py", line 315, in startElementNS
(did_replace, type_class) = XSI._InterpretTypeAttribute(attrs.getValue(self.__XSITypeTuple), ns_ctx, None, type_class)
File ".../pyxb/namespace/builtin.py", line 112, in _InterpretTypeAttribute
raise pyxb.BadDocumentError('%s value %s is not subclass of element type %s' % (type_name, type_en, type_class._ExpandedName))
pyxb.exceptions_.BadDocumentError: xs:string value {http://www.w3.org/2001/XMLSchema}string is not subclass of element type {http://www.w3.org/2001/XMLSchema}anyType
Apparently, "xs:string" is not recognized as subtype of "xs:anyType".
In addition, it is not obvious, how to create (e.g.) "AttributeValue" elements from Python in a way that the associated xml document meets the specification for "xs:anyType".
Fixed in 6a684348, which is within the "next" branch.
The ur-type is now recognized as valid for any content. Related problems have also been fixed; see the commit log.
See tests/trac/test-trac-0094.py for various examples.