Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


The same element in one content model with different type

From: "Michael Stolp" <Michael.Stolp@----.----------.-->
To: xmlschema-dev@--.---
Date: 11/3/2005 1:44:00 PM
Hello list.

I have a problem to write a schema for the following:

<Bar id="Bar2" original_id="B5" zIndex="1">
	<Point posRef="pos2" id="Bar2.pt1" role="start"/>
	<Point posRef="pos3" id="Bar2.pt2" role="end"/>
	<Point posRef="pos5" id="Bar2.pt3" role="middle1"/>
</Bar>

A Bar _must_ have start and end Point and _can_ have 0 or more middle
Points.
But how to define this in the schema?
I did try the following:

<xs:element name="Point" type="point_type"/>

<xs:complexType name="point_type">
	<xs:attribute name="id" type="xs:NMTOKEN"/>
	<xs:attribute name="posRef" type="xs:NMTOKEN"/>
	<xs:attribute name="role" type="xs:NMTOKEN"/>
</xs:complexType>

<xs:element name="Bar">
	<xs:complexType>
		<xs:sequence>
			<xs:element name="Point" minOccurs="2" maxOccurs="2">
				<xs:complexType>
					<xs:complexContent>
						<xs:restriction base="point_type">
							<xs:attribute name="id" type="xs:NMTOKEN"/>
							<xs:attribute name="posRef" type="xs:NMTOKEN"/>
							<xs:attribute name="role" use="required">
								<xs:simpleType>
									<xs:restriction base="xs:NMTOKEN">
										<xs:pattern value="(start|end)"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:attribute>
						</xs:restriction>
					</xs:complexContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="Point" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:complexContent>
						<xs:restriction base="point_type">
							<xs:attribute name="id" type="xs:NMTOKEN"/>
							<xs:attribute name="posRef" type="xs:NMTOKEN"/>
							<xs:attribute name="role" use="required">
								<xs:simpleType>
									<xs:restriction base="xs:NMTOKEN">
										<xs:pattern value="middle(0|[1-9][0-9]*)"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:attribute>
						</xs:restriction>
					</xs:complexContent>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="id">
			<xs:simpleType>
				<xs:restriction base="xs:NMTOKEN">
					<xs:pattern value="Bar(0|[1-9][0-9]*)"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="original_id" type="xs:string"/>
		<xs:attribute name="zIndex" type="xs:string"/>
	</xs:complexType>
	<xs:unique name="roleUnique">
		<xs:selector xpath="Point"/>
		<xs:field xpath="@role"/>
	</xs:unique>
</xs:element>

But an error occurs due to the Point element appears in the same content
model more than one time, but "does'nt refer to
a type definition of the highest level".

Please post your suggestions to solve my problem.


MfG Michael Stolp


From mike@s... Thu Nov 03 12:09:12 2005
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with esmtp (Exi


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent