Next in thread →
Next in month →
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. > > Comments? 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. TomP
Next in thread →
Next in month →