[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Describing hierarchies with XML

  • To: XML-Dev <xml-dev@l...>
  • Subject: Describing hierarchies with XML
  • From: Frans Englich <frans.englich@t...>
  • Date: Tue, 26 Oct 2004 08:25:54 +0000
  • User-agent: KMail/1.7

xml hierarchy menu

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.