|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Describing hierarchies with XML
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








