Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why choose ordered tree or unordered tree? 1

Status
Not open for further replies.

NMDUC

Programmer
Mar 4, 2006
61
VN
Hello,
I am doing a research in change detection. However, my knowledge in XML is not enough. I see that the XML document is often represented as tree structure. But in some papers it is a unordered tree. It might be a ordered tree in others. Can you tell me the reasons they choose it, please?

Thank you in advance.
 
>I see that the XML document is often represented as tree structure.
I guess it should not be "often". I would say you can say it more catergoric without "often", meaning "always".

>I see that the XML document is often represented as tree structure. But in some papers it is a unordered tree.
I would say, as a matter of understanding, the standard is not restricted it to any type. The ramification, a bit naive here, is that for a pure ordered xml document tree, you are restricted to only sequence content particles in its dtd definition, like this.
[tt]<!ELEMENT w (x,y,z)>[/tt]
However, for purely unordered tree type, the validating dtd would be restricted to only choice content particles.
[tt]<!ELEMENT s (t|u|v)>[/tt]
Besides you could equally ask why there is not n-ary restriction too. But, all these restrictions would be too severe for real-world app and non-abstract-thinking average "professionals".

It is a good topic for research though I would guess. As you might know ordered tree can be mapped to a binary tree. And also the complexity of an enumeration of unordered tree is not more than of an ordered tree.

Hence, what I would say as to "why" is that the standard is not drafted with 100% freedom. It must be a trade off among easiness of use and understood and implementation, and rigor.
 
An XML file can have it's elements ordered or unordered, depending on how it was designed.

If it uses an XSD file to define the structure of the XML file, look for "Sequence" to define an ordered set of elements, or "Choice" to define an unordered set.

But since most people don't define their XML that rigorously, if you get a file from another source, it's pretty much a toss-up as to what they meant.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top