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

RE: Describing hierarchies with XML

  • To: "Frans Englich" <frans.englich@t...>,"XML-Dev" <xml-dev@l...>
  • Subject: RE: Describing hierarchies with XML
  • From: "Hunsberger, Peter" <Peter.Hunsberger@S...>
  • Date: Tue, 26 Oct 2004 09:34:16 -0500
  • Thread-index: AcS7NSRf1TKMTEZoQkiZzPCtsrRg7gAMZDhw
  • Thread-topic: Describing hierarchies with XML

idref s in xquery
Frans Englich <frans.englich@t...> asks:
> 
> 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:
  
<snip>non-XML possibility</snip>
  
> 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. 

<snip>more discussion</snip>

As others have pointed out, if you want to validate this you need to
have some kind of type added to the various menu parts.  This can be
either an attribute or make the element name the type and move the name
into an attribute or sub-element (yuck).  Personally, I think you can go
either way; support for multiple languages should be done via reference
into an external library via idRef's or such so that needn't come into
play when deciding on the structure here, eg:

<menu titleId="123">
	<programs type="menuItem" titleRef="124" helpRef="456">
		<utilities type="menuItem" titleRef="125"/>
	</programs>
</menu>

Works as does:
 
<menu titleId="123">
	<menuItem titleRefId="124" helpRefId="456" programRefId="789">
		<menuItem titleRefId="125" programRefId="790"/>
	</menuitem>
</menu>

Pick you language library as needed, fall back as allowed, somewhere you
should have an entry for title="123", etc.

OTOH, going with the freedesktop.org format makes even more sense if it
fit's your needs...



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.