XML Document Design to represent a Heirarchy

Discussion in 'XML' started by Trevor Andrew, Jul 21, 2003.

  1. Hi There,

    I was wanting some advice regarding the best-practice approach to
    representing a hierarchy in XML. Let me explain by an example of the two
    different approaches I have seen.

    In the first example all of the data in the document is enclosed within what
    might be an ambiguous <categories> node. However on some occasions there
    might be some need for this node to have some attributes. And then for
    individual <category> nodes within that, they again have a <categories> node
    within which child <category> nodes exist.

    In the second example, the <categories> nodes are eliminated and hierarchy
    is represented simply by there being <category> nodes within <category>
    nodes.

    Example 1

    <root>
    <categories>
    <category>
    ...
    </category>
    <category>
    ...
    <categories>
    <category> ... </category>
    <category> ... </category>
    </categories>
    <category>
    </categories>
    </root>

    Example 2

    <root>
    <category>
    ...
    </category>
    <category>
    ...
    <category>
    </category>
    <category>
    </category>
    </category>
    </root>

    What I would like guidance on is which approach would be considered
    "best-practice", or are both valid in different circumstances? Additionally,
    does anyone have some good references on where I could research these XML
    design issues further? Are there any ramifications with regard to writing an
    XSD schema for such document?

    Thanks in Advance,
    Trevor Andrew
     
    Trevor Andrew, Jul 21, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Tyler

    Package heirarchy

    Tim Tyler, Aug 5, 2003, in forum: Java
    Replies:
    0
    Views:
    421
    Tim Tyler
    Aug 5, 2003
  2. Replies:
    0
    Views:
    353
  3. Tony Prichard
    Replies:
    0
    Views:
    788
    Tony Prichard
    Dec 12, 2003
  4. thomson

    User Control in a Page Heirarchy

    thomson, Jan 5, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    303
    thomson
    Jan 5, 2007
  5. falcon
    Replies:
    4
    Views:
    380
    John Ersatznom
    Jan 16, 2007
Loading...

Share This Page