xml style questions

Deborah Aleyne Lapeyre dalapeyre at mulberrytech.com
Mon Mar 1 23:47:28 GMT 1999


Mark Anderson wrote:
>any words of wisdom regarding:
>1) having an extra collection layer in the xml tree, like
><root><things><thing></thing><thing></thing></things><another></another></root>
>vs.
><root>><thing></thing><thing></thing><another></another></root>

If you have ANY reason to think you may need the collection layer,
put it in.  Reasons you might want it include things like:

  a) Reuse - <thing>s are frequently used together
     and you want electronic cut-and-paste and/or
     even a really stupid parsing algorithm to be
     able to find them all easily.

     The converse is the same, if you want to ignore
     all <thing>s, group them.

  b) You need some sort of behavior or formatting
     at the collection level.  This could be as simple
     as wanting a new indent level in the
     generated toc.  This is the most
     common reason in practice.

  c) For correct hierarchical layering, <thing>s
     just aren't as big and important as <another>s
     so they don't belong at the same level.

etc.  Yes, much of this could also be done by asking
if you are the first <thing> among your siblings, etc.
But sometimes event-driven processing is easier or faster
than tree walking, and a containing element gives you
your event.


>2) having PCDATA vs. having a distinct "comment" or "description" element
>child:
><thing a="1" b="2">this is the description of this thing
><some_child></some_child>></thing>
>vs.
><thing a="1" b="2"><desc>this is the description of this thing</desc>
><some_child></some_child></thing>

As a style issue, I favor the explicit description.  Makes programming life
easier all around, costs next to nothing.  Programs can easily find the two
equivalent, but, in my experience, people don't.

--Debbie









======================================================================
Deborah Aleyne Lapeyre               mailto:dalapeyre at mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9633
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================



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