tags:

views:

65

answers:

0

What is the best way to represent a tree structure with XML? Each element in the XML tree has an attribute that refers to a node, X, in the tree which I speak of. However, the element has to also be duplicated such that the attribute also refers to all roots in the subtree rooted at X. This can become very repetitive when you have many elements referring to X or even one of the nodes in the subtree for X. Thus, what is the best way to represent the tree of nodes in XML so that I do not have to repeat the element (and possibly more elements) for every node that lies under X?

Edit (non author): I'd like to see this re-opened and I hope the following clarifies what I see in it: "Given a tree structure that may contain recursion and/or duplicate branches, what is a good way to efficiently (avoid duplication) and practically (for the recursion case) encode this into XML? As some kind of delayed/symbolic process is required (??), is there any standard format/convention used to address this type of encoding?"