Why doesn't XML have Bag? Uh, "set"
David Megginson
david at megginson.com
Fri Mar 26 15:19:57 GMT 1999
Roger L. Costello writes:
> Thanks Dave for clarifying terminology. It is "set" that I meant, not
> "bag". Just to make certain that I understand, an XML DTD cannot
> express the following:
>
> "A <Kitchen> element contains exactly three child elements: one instance
> of <Sink>, one instance of <Stove>, and one instance of <Refrigerator>,
> and these child elements can appear in any order."
>
> Correct? /Roger
More or less. Technically, you *can* express this constraint with an
XML DTD:
((sink, ((stove, refrigerator) | (refrigerator, stove))) |
(stove, ((sink, refrigerator) | (refrigerator, sink))) |
(refrigerator, ((sink, stove) | (stove, sink))))
Obviously, things get unmanageable if the set grows a little bigger.
In an SGML DTD, you would use
(sink & stove & refrigerator)
but in practical use, this never worked that well for documents except
in the special case of legacy-data conversion (it confused people
using authoring tools and generally made processing unnecessarily
difficult), and most SGML gurus strongly deprecated it. XML is
hitting a slightly different usage domain (less emphasis on documents,
more on data), so perhaps it might be worthwhile including this in the
new schema standard.
> P.S. Attributes can be listed in any order in an XML document,
> regardless of the order that they are listed in the DTD. Right?
Right -- order and repetition are properties of elements but not of
attributes.
All the best,
David
--
David Megginson david at megginson.com
http://www.megginson.com/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list