[Home] [By Thread] [By Date] [Recent Entries]


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@m...
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

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member