[
Lists Home |
Date Index |
Thread Index
]
- From: Paul Prescod <papresco@technologist.com>
- To: xml-dev@ic.ac.uk
- Date: Mon, 25 May 1998 10:38:27 -0400
Ron Bourret wrote:
>
> Trees vs. Events
> ----------------
> It seems like we need to decide early on whether we are interested in getting
> the DTD as events or a tree.
I think that we are defining a language, not an API. Since the language
will use XML instance syntax, whether you get access to it as a tree or
events will depend entirely on whether your processor uses SAX or the DOM
(or something else altogether).
> Notice that the definitions of a and b are at the same level. That is, when I
> build a DOM tree from this XML, a and b are siblings, not parent and child.
> When exploring a DTD, the parent-child relationship is far nicer -- I move up
> and down the DOM tree and get the metadata I need at each level. On the other
> hand, such a tree complicates the DTD (sorry ;) for XSchema/XTD/etc. and I'm not
> sure if representing children with multiple parents would even be possible,
> given the strict nesting requirements of XML. Comments?
Your last instinct is correct. A DTD is not a tree, but a directed acyclic
graph. There is no way to define any but the most trivial DTD as a tree:
<!ELEMENT Paragraph (#PCDATA|Emph)>
<!ELEMENT Title (#PCDATA|Emph)>
<!ELEMENT Emph (#PCDATA)>
Emph is used twice, so this simple (and typical) DTD is not a tree and
cannot be represented using XML element nesting.
Paul Prescod - http://itrc.uwaterloo.ca/~papresco
"You have the wrong number."
"Eh? Isn't that the Odeon?"
"No, this is the Great Theater of Life. Admission is free, but the
taxation is mortal. You come when you can, and leave when you must. The
show is continuous. Good-night." -- Robertson Davies, "The Cunning Man"
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|