I have a database containing countries and cities. I want to export this information to an XML document, but I am wondering how to structure it.
Should I do it like this:
<country>
<name>Canada</name>
<city>
<name>Toronto</name>
<population>1423200</population>
</city>
<city>
<name>Ottawa</name>
<population>1423200</population>
</city>
</country>
or like this:
<country>
<name>Canada</name>
<cities>
<city>
<name>Toronto</name>
<population>1423200</population>
</city>
<city>
<name>Ottawa</name>
<population>1423200</population>
</city>
</cities>
</country>
or like this:
<entity>
<country>Canada</country>
<city>Ottawa</city>
<city_population>1423200</city_population>
</entity>
<entity>
<country>Canada</country>
<city>Toronto</city>
<city_population>1423200</city_population>
</entity>
What are the pros and cons with each of them? is there any other way of structuring?
which one is best for future changes (adding data).
my first time to structure in xml would be great with reviews / tips!
ajsie source
share