DISCLAIMER: I am not too well versed in XSD, and may be expressing myself incorrectly.
I have an XML file I need to validate and handle. I can change the XSDs but not the XML.
The XML file is of type a.xsd, and a.xsd includes a type from b.xsd. This type is called in the XML referring the namespace, like so:
<StuffDtl>
<elem1>test string</elem1>
<elem2>9</elem2>
<supertype:uuuh_special>test string</supertype:uuuh_special>
</StuffDtl>
The XSDs are defined like below:
a.xsd
<!-- language: lang-xml -->
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:supertype="http://www.b.com">
<xs:import namespace="http://www.b.com"
schemaLocation="b.xsd" />
<xs:element name="StuffDtl">
<xs:complexType>
<xs:sequence>
<xs:element name="elem1" type="xs:decimal" />
<xs:element name="elem2" type="xs:int" />
<xs:element name="uuuh_special" type="supertype:SuperType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
b.xsd
<!-- language: lang-xml -->
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.b.com"
elementFormDefault="qualified">
<xs:complexType name="SuperType">
<xs:sequence>
<xs:choice>
<xs:group ref="one_thing" />
<xs:group ref="another_thing" />
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:group name="one_thing">
<xs:sequence>
<xs:element name="year" type="xs:decimal" />
<xs:sequence minOccurs="0">
<xs:element name="hour" type="xs:decimal" />
</xs:sequence>
</xs:sequence>
</xs:group>
<xs:group name="another_thing">
<xs:sequence>
<xs:element name="date-value" type="xs:string" />
<xs:element name="date-format" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:group>
</xs:schema>