Hi, ☺
How do I use PHP DOM XML to output all XMLNS declared troughout the DOM to the root element? See below code, and the actual output and the desired output.
PHP Code:
<?php
$XML = new DOMDocument("1.0", "UTF-8");
$Atom = $XML->appendChild($XML->createElementNS("http://www.w3.org/2005/Atom", "feed"));
$Atom->appendChild($XML->createElementNS("http://www.w3.org/1999/xhtml", "xht:strong", "fet tekst"));
$Atom->appendChild($XML->createElementNS("http://www.w3.org/1999/xhtml", "xht:strong", "fet tekst2"));
$XML->formatOutput = true;
printf($XML->saveXML()); ?>
Quote:
|
Originally Posted by Output
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<xht:strong xmlns:xht="http://www.w3.org/1999/xhtml">fet tekst</xht:strong>
<xht:strong xmlns:xht="http://www.w3.org/1999/xhtml">fet tekst2</xht:strong>
</feed>
|
Quote:
|
Originally Posted by Desired output
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:xht="http://www.w3.org/1999/xhtml">
<xht:strong>fet tekst</xht:strong>
<xht:strong>fet tekst2</xht:strong>
</feed>
|
__________________
I do not share ad revenue.
|