Reputation: 1903
I have a list of file names and each file has a checksum. What is the best way about organizing this data in an xml file? So far I have:
<tables>
<table name="test1.txt">"KMDalk4lsmxf#lsfjs_akmf3"</table>
<table name="test2.txt">"asd6o9iASla0gbd#0saaj234"</table>
<table name="test3.txt">"S9rk2jalkjf93klsa+jmskl2"</table>
<table name="test4.txt">"aj54oislkaoi309aSWpoa2JD"</table>
</tables>
Now, using XMLReader I want to be able to find a table by name only and then return the checksum. How do I go about this? Is it best to use attributes or elements for file names?
Upvotes: 1
Views: 112
Reputation: 5832
Store checksum in attribute, like this:
<tables>
<table name="test1.txt" checksum="KMDalk4lsmxf#lsfjs_akmf3"/>
<table name="test2.txt" checksum="asd6o9iASla0gbd#0saaj234"/>
<table name="test3.txt" checksum="S9rk2jalkjf93klsa+jmskl2"/>
<table name="test4.txt" checksum="aj54oislkaoi309aSWpoa2JD"/>
</tables>
It will be more consistent.
But in fact there's no much difference, most performance will go into finding a node with matching name
anyway.
Upvotes: 2