OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] A flexible way to represent trees in XML

On 1/20/2017 11:02 AM, Costello, Roger L. wrote:
Hi Folks,

As you know, a tree data structure can be represented in XML using
parent-child relationships.

Lesson Learned: The binary relation representation is a flexible way to
represent trees.

Caveat: Of course, it is not wise to use binary relations exclusively.
That would defeat the purpose of XML. Parent-child relationships are
very useful. So, you might have a part of your XML document where great
flexibility is needed. That would be a good use of binary relations –
embedded within a larger XML document. The binary relation contains
volatile stuff; the other part contains the non-volatile stuff. This way
you minimize the need for schema changes.

Or you could give every node an ID attribute. Then you can add attributes presenting parent and child, which point to other IDs. By adding the right parent/child attributes, you can get the same nodes to represent any number of trees, even simultaneously. The only schema changes needed would be the new parent/child attributes.

Roger seems to like to avoid attributes. But sometimes they make things simpler.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS