April 08, 2003
Ensureing sequence of XML tags

Time to selfishly summoning the LazyWeb (hoping this is appropriate)...: a colleague has asked me the following question, and I can't find an explicit, definitive answer. Can anyone help?

Do you know if an XML Schema defines the order of child elements (XML tags) in an XML message.

E.g. does the schema below define that the order of the child elements always will appear in the order shown in the sample XML message below:

Schema:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Child1" type="xs:string"/>
<xs:element name="Child2" type="xs:string"/>
<xs:element name="Child3" type="xs:string"/>
<xs:element name="Parent">
<xs:complexType>
<xs:sequence>
<xs:element ref="Child1"/>
<xs:element ref="Child2"/>
<xs:element ref="Child3"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XML Message:
<?xml version="1.0" encoding="UTF-8"?>
<Parent>
<Child1>A</Child1>
<Child2>B</Child2>
<Child3>C</Child3>
</Parent>
Thanks in advance! (Please post your answer; preferably with supporting URLs; in the comments section below)

Sponsored links
Related Entries
Comments

yes it does.

if you want some good reading, i recommend the book Definitive XML Schema (ISBN: 0130655678). its by the folks who wrote the XML Schema specification. definetly worth the money.

Posted by: sungo on April 8, 2003 08:53 PM

Thanks for the quick reply!

Posted by: Anders on April 8, 2003 09:54 PM

Why not just go to the source. They've got lots of great stuff on schemas.

Ack-- no linking, I see...

Here is the source:
http://www.w3.org/

Here is a list of w3c resources:
http://www.w3.org/XML/Schema

Here is their Schema Primer:
http://www.w3.org/TR/xmlschema-0/

Posted by: johnp on April 11, 2003 08:43 PM
Post a comment
Name:


Email:
(Will not be displayed if you enter a website below. Otherwise, it will be displayed "spam protected")


Website:
(if you have one)


What do you want to say?
(please don't bother posting "spam" (pornography, viagra-sales etc - I will delete such comments anyway))


Remember info?



Referrers to this page
TrackBack URL for this entry:
http://www.jacobsen.no/cgi-sys/cgiwrap/anders/MT/mt-tb.cgi/435

7065 visits (3 today, 14 this week)

© Anders Jacobsen
[weblog / photography]