Hi,
I'm planning on using an XML-file as input for a php-script. While designing the XML-file I came across 2 different ways to store the data. Method 1 using just xml-tags and method 2 using attributes inside the tags.
Method 1:
Method 2:
What is the correct (or recommended) way to use XML for data storage?
Thanx! Michiel
I'm planning on using an XML-file as input for a php-script. While designing the XML-file I came across 2 different ways to store the data. Method 1 using just xml-tags and method 2 using attributes inside the tags.
Method 1:
PHP Code:
<cookbook>
<recipe>
<id>
1
</id>
<name>
Spaghetti Carbonara
<name>
<ingredients>
etc.
etc.
</ingredients>
</recipe>
</cookbook>
PHP Code:
<cookbook>
<recipe id="1" name="Spaghetti Carbonara">
<ingredients>
etc.
etc.
</ingredients>
</recipe>
</cookbook>
Thanx! Michiel
Comment