I am trying to achieve below format in XML (generated with PHP):
<ns0:XmlInterchange xmlns:ns0="http://www.website.com" xmlns:ext="http://www.website.com">
<ns0:InterchangeInfo>
<ns0:Date>2017-06-28T11:33:15</ns0:Date>
<ns0:XmlType>Verbose</ns0:XmlType>
<ns0:Source>
<ns0:EnterpriseCode>DSV</ns0:EnterpriseCode>
<ns0:OriginServer>ESB</ns0:OriginServer>
</ns0:Source>
<ns0:EDIOrganisation EDICode="0"/>
</ns0:InterchangeInfo>
</ns0:XmlInterchange>
So, right now, all I have is this:
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->formatOutput = true;
$rss = $xml->createElement('ns0');
$rss->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:ns0', 'http://website.com');
$rss->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:ext', 'http://website.com');
$xml->appendChild($rss);
Which outputs this:
<ns0 xmlns:ns0="http://website.com" xmlns:ext="http://website.com"/>
The problem above is the beginning of the XML. It needs to be:
<ns0:XmlInterchange xmlns:ns0="http://website.com" xmlns:ext="http://website.com"/>
How can I add the :XmlInterchange namespace to the beginning of the tag?