Possible Duplicate:
XML attribute vs XML element
What is the difference between snippet "A":
<root>
<item id="1">
<attr1> foo </attr1>
<attr2> bar </attr2>
</item>
</root>
and placing the "id" attribute within the element in snippet "B":
<root>
<item>
<id> 1 </id>
<attr1> foo </attr1>
<attr2> bar </attr2>
</item>
</root>
and how would I add the attribute "id" when creating xml with PHP in snippet "A" assuming I can already create the format of snippet "B" just fine using DOM's createElement()
and appendChild
?
Thanks!