Example XML using element nodes:
<?xml version="1.0" encoding="utf-8"?>
<users>
<user>
<name>David Smith</name>
<phone>0441 234443</phone>
<email>
[email protected]</email>
<addresses>
<address>
<street>1 Some Street</street>
<town>Toy Town</town>
<country>UK</country>
</address>
<address>
<street>5 New Street</street>
<town>Lego City</town>
<country>US</country>
</address>
</addresses>
</user>
</users>
Example XML using attributes:
<?xml version="1.0" encoding="utf-8"?>
<users>
<user name="David Smith" phone="0441 234443" email="
[email protected]">
<addresses>
<address street="1 Some Street" town="Toy
Town" country="UK" />
<address street="5 New Street" town="Lego City" country="US" />
</addresses>
</user>
</users>
I'm needing to build an XML file based on data from a relation database and can't work out whether I should use attributes or elements.
What is best practice when building XML files?