-
The problem with substitutionGroups
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="uniqueString">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="uuid" type="uuid" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="uniqueString" type="uniqueString" abstract="true"/>
<xs:simpleType name="uuid">
<xs:restriction base="xs:string">
<xs attern value="[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="uniqueUuid">
<xs:simpleContent>
<xs:extension base="uuid">
<xs:attribute name="uuid" type="uuid" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="uniqueUuid" type="uniqueUuid" abstract="true"/>
<xs:element name="parent" type="uniqueString" abstract="true"/>
<xs:element name="child" type="uniqueString" abstract="true"/>
<xs:element name="hierarchy" abstract="true">
<xs:complexType>
<xs:sequence>
<xs:element ref="parent"/>
<xs:element ref="child" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="hierarchy">
<xs:sequence>
<xs:element ref="hierarchy"/>
</xs:sequence>
</xs:complexType>
<xs:element name="xHierarchy" substitutionGroup="hierarchy"/>
<xs:element name="containingX" substitutionGroup="parent"/>
<xs:element name="containedX" substitutionGroup="child"/>
<xs:element name="X">
<xs:complexType>
<xs:sequence>
<xs:element name="xHierarchy" type="hierarchy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="yHierarchy" substitutionGroup="hierarchy"/>
<xs:element name="containingY" substitutionGroup="parent"/>
<xs:element name="containedY" substitutionGroup="child"/>
<xs:element name="Y">
<xs:complexType>
<xs:sequence>
<xs:element name="yHierarchy" type="hierarchy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
given the above schema definition containingX can be used interchangably with containingY and containedX can be used interchangably with containedY. This is undesirable for the system I'm working on - is there a way to allow multiple hierarchy elements to be defined within a single .xsd that are derived from the same hierarchy complexType without having interchangable parent elements and interchangable child elements.
Similar Threads
-
Replies: 11
Last Post: 11-16-2007, 12:23 PM
-
By Shannon in forum VB Classic
Replies: 7
Last Post: 06-24-2007, 08:47 PM
-
Replies: 0
Last Post: 12-13-2001, 12:06 PM
-
By Ayman in forum VB Classic
Replies: 0
Last Post: 04-03-2000, 01:08 AM
-
By Jason Bock in forum VB Classic
Replies: 0
Last Post: 03-21-2000, 06:48 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks