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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Describing hierarchies with XML

[ Lists Home | Date Index | Thread Index ]


Hello all,

I have trouble determining the optimal design/format for an XML 
document. The situation is identical to if each entry in a MS 
Windows/KDE/GNOME start menu were represented by an XML document, and that 
its hierarchical position(it's category) should be described.

An example: the program Calculator's XML document looks like this:

<program>
	<name>Calculator</name>
</program>

And I want to describe that it should be located in /Menu/Programs/Utilities. 
One possibility is:

<program>
	<category>/Menu/Programs/Utilities</category>
	<name>Calculator</name>
</program>

But I don't find it XML-like, and it must be troublesome when it comes to 
interpreting the data for using it; it requires resorting to string parsing 
instead of using the DOM.

Another possibility is:

<program>
	<category>
			<menu>
				<programs>
					<utilities/>
				</programs>
			</menu>
	</category>
	<name>Calculator</name>
</program>


That is, the hierarchy translates directly to the XML document where each 
category is an element. 

No matter what solution, it should be described in an XML Schema, and should 
be possible to validate. Instances will be read and computed with XSLT. 

My problem is to determine what solution that is the most generic, flexible, 
policy-free, and the Right Way. From an XSLT perspective, the latter seems 
convenient(it's easy to say "give me all entries in menu-programs-utilities" 
or "give me all programs in menu-programs"), on the other hand it looks very 
untraditional. What are the respective drawbacks/advantages of the two? Is 
there an alternative to the two options I proposed?

It feels like my trouble is a common, out-of-the-book, design problem. Perhaps 
you know how it is optimally solved?

Also, if there's a book/document that deals with this kind of issues on 
whatever level, feel free to recommend.


Cheers,

		Frans





 

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

Copyright 2001 XML.org. This site is hosted by OASIS