[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Schema Element ordering

From: Rich Adili <Rich.Adili@xata.com>
Date: Thu, 17 May 2007 23:10:53 -0500
Message-ID: <A0340B4A1C76734798D48BF3F09C62061F9537@EXCHVS01.xata.com>
To: <xmlschema-dev@w3.org>
XML Schema Element ordering
I suppose this is a noob question but I've not found a good answer yet,
so...

This xml will not validate against the enclosed schema unless I reorder
the four text elements to match. How can I adjust the schema to allow
mix-and-match ordering of the elements without breaking the "Upper" and
"Lower" set relationships? I've heard the lecture that node order
shouldn't matter in XML but my boss is funny about giving orders and
having them followed...

<?xml version="1.0" encoding="UTF-8"?>
<Upper xsi:noNamespaceSchemaLocation="junk.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ValidationError>text</ValidationError>
	<WildAndCrazy>text</WildAndCrazy>
	<ValidationWarning>text</ValidationWarning>
	<Guy>text</Guy>
</Upper>

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:complexType name="Lower" abstract="true">
		<xsd:sequence minOccurs="0" maxOccurs="unbounded">
			<xsd:element ref="ValidationError"
minOccurs="0"/>
			<xsd:element ref="ValidationWarning"
minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="ValidationError"/>
	<xsd:element name="ValidationWarning"/>
	<xsd:element name="Upper">
		<xsd:complexType>
			<xsd:complexContent>
				<xsd:extension base="Lower">
					<xsd:sequence minOccurs="0"
maxOccurs="unbounded">
						<xsd:element
ref="WildAndCrazy" minOccurs="0"/>
						<xsd:element ref="Guy"
minOccurs="0"/>
					</xsd:sequence>
				</xsd:extension>
			</xsd:complexContent>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="WildAndCrazy"/>
	<xsd:element name="Guy"/>
</xsd:schema>
Received on Friday, 18 May 2007 08:14:05 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.