0

Is it valid to have two xsd's import each other?

For example, the first one is 'MyService.xsd=48 and it looks like:

<?xml version='1.0' encoding='UTF-8'?>
<xs:schema xmlns:tns="http://documentation" xmlns:ns1="http://documentHistory" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" version="1.0" targetNamespace="http://documentation">

<xs:import namespace="http://documentHistory" schemaLocation="MyService.xsd=49" />

<xs:complexType name="item">
  <xs:sequence>
    <xs:element name="internalId" type="xs:long" minOccurs="0" />
    <xs:element name="readOnly" type="xs:boolean" minOccurs="0" />
  </xs:sequence>
</xs:complexType>

<xs:complexType name="data">
  <xs:sequence>
    <xs:element name="histories" type="ns1:history" nillable="true" minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
</xs:complexType>

</xs:schema>

The second xsd is MyService.xsd=49 and looks like:

<?xml version='1.0' encoding='UTF-8'?>
<xs:schema xmlns:tns="http://documentHistory" xmlns:ns1="http://documentation" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" version="1.0" targetNamespace="http://documentHistory">

<xs:import namespace="http://documentation" schemaLocation="MyService.xsd=48" />

<xs:complexType name="history">
    <xs:complexContent>
        <xs:extension base="ns1:item">
            <xs:sequence>
                <xs:element name="dateReceived" type="xs:dateTime" minOccurs="0" />
                <xs:element name="dateSent" type="xs:dateTime" minOccurs="0" />
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

</xs:schema>

Notice that the first one imports the second one and the second one imports the first one. I have an issue that I'm trying to track down and I don't know if this is part of the problem or not. The issue I'm trying to solve has to do with TCL not seeming to parse my wsdl correctly. After TCL parses the wsdl into a dict, the 'history' object doesn't have the properties from the 'item' object, even though the xsd shows that history should extend from item.

The question is: is it valid for two xsd's to import each other or does this look like a problem?

Also, I already looked at this post XSD circular import but found the answer difficult to understand. Any help / insight would be greatly appreciated. Thanks!

Community
  • 1
  • 1
Jess
  • 140
  • 1
  • 1
  • 8
  • Leaving aside parsing issues, it seems _very_ odd to me to have two schemas including/importing each other. As if you've not really got independent schemas at all, and are just partitioning stuff for giggles. Also, those schema URLs make me want to cry. – Donal Fellows Nov 18 '15 at 20:22
  • http://stackoverflow.com/questions/10755288/xsd-import-namespaces – David Lizárraga Nov 20 '15 at 09:43

0 Answers0