Handling element collisions on importing/including XML schemas
- by eggyal
Given schema definitions that define the same element differently, can one import/include both definitions and reference them independently from within a third schema definition?
For example, given:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:example:namespace">
<element name="message" type="boolean"/>
</schema>
and:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:example:namespace">
<element name="message" type="date"/>
</schema>
Can one construct the following:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:example:namespace">
<complexType name="booleanMessageType">
<xs:sequence>
<!-- reference to first definition here -->
</xs:sequence>
</complexType>
<complexType name="dateMessageType">
<xs:sequence>
<!-- reference to second definition here -->
</xs:sequence>
</complexType>
</schema>