At 04:24 PM 08/25/1999 -0400, Tac/Smokescreen Action Network wrote:
>...is there any good reason to
>group the lists together into list elements, e.g.
><!ELEMENT AUTHOR_LIST (AUTHOR*)>
><!ELEMENT AUTHOR (Name*)>
><!ELEMENT RECIPIENT_LIST (RECIPIENT*)>
><!ELEMENT RECIPIENT (Name*)>
>I did this on my first attempt at XML, but the reason was that I wanted to
>check for the existence of an element before writing out a header (and then
>looping through the individual items) in my XSL, but that design is probably
>based on my own inability to check for the existence of something before
>beginning a loop on it.
I don't know if my reasons qualify as good ones or not, but personally I
like to do this sort of "grouping." Two reasons, off the top of my head:
(1) Aesthetically and logically, it enforces on the content a structure
that seems more purely in keeping with XML's nature. It's certainly
possible (and in some cases maybe even desirable) to build a more or less
completely flat-structured document. Have you seen MSIE's default
representation of a well-formed XML document -- the collapsible/expandable
tree? A document "structured" in this flat style would look something like
- Root element
- Element 1
- Element 2
- Element 3
Not much of a "structure," eh? To the extent that XML is explicitly about
data structures, why not take advantage of it?
(2) I came to XML with background in RDBMSes (as well as HTML). For this
reason, I tend to think of data stores in terms of tables and records.
Under this model, what you're calling a grouping might be analogous to a
table, with the individual sub-elements constituting records within the
table. Now, the similarities between XML and RDBMS sructure aren't perfect,
but I do like the idea of being able to manipulate a collection of like
things *as* a collection, as well as singly or in one-after-the-other fashion.
As with anything else, it's possible to overdo the "structuralizing" of a
document. But once it's been structured, it's a relatively simple matter to
*reduce* the structure for a given purpose, via XSL or some other
programmatic means. Much harder to go in the other direction. So I prefer
to err on the side of not knowing to what purpose the data might be put, by
structuring it as much as possible.
John E. Simpson
[log in to unmask]
Just XML - Now available from Prentice-Hall