Thanks you so much for your help. This is the exact answer I was looking
From: Wendell Piez [mailto:[log in to unmask]]
Sent: Friday, September 28, 2001 1:00 PM
To: [log in to unmask]
Subject: Re: Order of XML Tags.
Yes, if the DTD says
<!ELEMENT AddressInformation (AddressLines, City, State, Zipcode) >
then when documents are validated, the order will be enforced.
If you want to allow any order to appear, you could rewrite this to:
<!ELEMENT AddressInformation (AddressLines | City | State | Zipcode)* >
(all subelements are optional)
<!ELEMENT AddressInformation (AddressLines | City | State | Zipcode)+ >
(at least one subelement must appear)
These are very loose content models, saying "inside AddressInformation any
of AddressLines, City, State and Zipcode are allowed, repeatedly, in any
Alas, XML DTD syntax has no simple way to express "any of AddressLines,
City, State and Zipcode are allowed, in any order, but each must appear
exactly once". SGML (on which XML is based) had such a construction, but it
was disallowed in XML DTD syntax. This was a controversial decision; it
turns out the requirement is after all common enough that XML Schema turned
around and provides a way to describe this. XML Spy supports Schema
validation, which you may be able to consider moving to.
If you only had two subelements, you could in an XML DTD say
<!ELEMENT AddressInformation ((AddressLines, City) | (City, AddressLines)) >
which in effect means "one of each, in either order". But as you can see,
this approach results in a combinatorial explosion in the content model as
the number of subelements goes up.
So basically you have three choices:
1. Loosen the model to allow the subelements to repeat, also relaxing the
2. Work out the hairy four-term content model to say "one of each in any
order" (sorry I don't have the patience to do this now :-).
3. Move to XML Schema.
I hope that helps--!
At 07:16 AM 9/28/01, you wrote:
>I am talking about a tag set. First instance. A parent tag of
><AddressInformation> with children of <AddressLines><City><State><Zipcode>.
>If this is specified in the DTD and run validated xml that is well formed
>against that DTD it will fail. It is failing DTD validation. Where/how do
>you specify order or not order in a DTD?
Wendell Piez mailto:[log in to unmask]
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
Mulberry Technologies: A Consultancy Specializing in SGML and XML