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] [newbie] Mapping a Map 101?

[ Lists Home | Date Index | Thread Index ]

PA wrote:

> Here is the equivalent XML version:
> 
> <dict>
>     <key>user</key>
>     <string>wshakesp</string>
>     <key>birth</key>
>     <integer>1564</integer>
>     <key>death</key>
>     <integer>1616</integer>
> </dict>
> 
> http://developer.apple.com/documentation/Cocoa/Conceptual/ 
> PropertyLists/Concepts/XMLPListsConcept.html
> 
> How would you make the XML format to represent such a dictionary  
> structure less "horrible"?
> 

I wouldn't rely on sibling relationships. Instead I'd write:

<dict>
   <entry>
      <key>user</key>
      <string>wshakesp</string>
   </entry>
   <entry>
      <key>birth</key>
      <integer>1564</integer>
   </entry>
   <entry>
      <key>death</key>
      <integer>1616</integer>
   </entry>
  </dict>

I might also rethink the notion of embedding the data types in the tag 
names, but then again I might not.

-- 
Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




 

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

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