I am using bindings generated by PyXB 1.2.6.
I have a schema which is (essentially):
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="foo_namespace" targetNamespace="foo_namespace" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="FooList">
<xs:complexType>
<xs:sequence>
<xs:element name="Foo" type="xs:string" minOccurs="0"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Paired with another schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="bar_namespace" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Bar" type="xs:string" minOccurs="0"/>
</xs:schema>
Parsing this XML sample:
<?xml version="1.0"?>
<foo:FooList xmlns:foo="foo_namespace" xmlns:bar="bar_namespace" xmlns:qux="qux_namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="foo_namespace file:///C:/code/temp/schema_tests/wildcard/wildcard_schema.xsd">
<foo:Foo>Foo A</foo:Foo>
<bar:Bar>Bar A</bar:Bar>
<qux:Qux>Qux A</qux:Qux>
</foo:FooList>
I can parse the sample with the bindings for the foo_namespace schema whether or not element Foo is present, and all non-Foo elements are placed into the wildcard elements (as expected).
When I include a binding for the bar_namespace schema, the XML sample is parsed correctly when the Foo element is present. However, if the Foo element is missing, I get the warning:
Multiple accepting paths for <class 'foo.CTD_ANON'>
It seems that the "Bar A" text gets parsed into the Foo element, and writing the XML back out results in:
<?xml version="1.0" ?>
<ns1:FooList xmlns:ns2="qux_namespace" xmlns:ns1="foo_namespace">
<ns1:Foo>Bar A</ns1:Foo>
<ns2:Qux>Qux A</ns2:Qux>
</ns1:FooList>
Is this schema truly ambiguous or is this a PyXB issue? I would think that the ##other attribute of the any element means that the {bar_namespace}Bar element is unambiguous, but it's possible I'm missing something. It's also not clear to me how the Bar element gets parsed into the Foo element.
Attached is code and samples reproducing the issue.
wildcard_tests.zip
I am using bindings generated by PyXB 1.2.6.
I have a schema which is (essentially):
Paired with another schema:
Parsing this XML sample:
I can parse the sample with the bindings for the
foo_namespaceschema whether or not elementFoois present, and all non-Fooelements are placed into the wildcard elements (as expected).When I include a binding for the
bar_namespaceschema, the XML sample is parsed correctly when theFooelement is present. However, if theFooelement is missing, I get the warning:Multiple accepting paths for <class 'foo.CTD_ANON'>It seems that the "Bar A" text gets parsed into the
Fooelement, and writing the XML back out results in:Is this schema truly ambiguous or is this a PyXB issue? I would think that the ##other attribute of the any element means that the
{bar_namespace}Barelement is unambiguous, but it's possible I'm missing something. It's also not clear to me how theBarelement gets parsed into theFooelement.Attached is code and samples reproducing the issue.
wildcard_tests.zip