I am attempting to create an XML file using PHP 5.6.24 and DOMDocument. The format of the XML is supposed to be as follows:
<parks xmlns:tch="{urn}" xmlns:prk="{urn}">
It is my understanding that the following block of code:
$root = $doc->createElementNS('http://www.w3.org/2005/Atom', 'element');
$doc->appendChild($root);
$root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:g', 'http://base.google.com/ns/1.0');
$item = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'house');
$root->appendChild($item);
Will allow me to produce the following output:
<element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
<g:item_type>house</g:item_type>
</element>
The problem with this is that this method only allows me to add one tagname as opposed to the two that I need (tch and prk).
Is it possible to achieve this result using the DOMDocument library or is there something better for this situation.
Thank you in advanced!!!!!!