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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Describing hierarchies with XML

[ Lists Home | Date Index | Thread Index ]

Frans Englich <frans.englich@telia.com> 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...






 

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

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