XML Dom: storing key/value pairs

Viewed 23974

I am new to dealing with XML and I have to store key/value pairs. Is there a preferred way of doing this? Here are a few possibilities I could come up with:

Way 1

<item key="k1" value="val1" />
<item key="k2" value="val2" />
<item key="k3" value="val3" />

Way 2

<item><key>k1</key><value>val1</value></item>
<item><key>k2</key><value>val2</value></item>
<item><key>k3</key><value>val3</value></item>

Way 3

<key name="k1">val1</key>
<key name="k2">val2</key>
<key name="k3">val3</key>

Thanks.

update: In the meantime I have found this: http://www.ibm.com/developerworks/xml/library/x-eleatt.html

7 Answers
Related