I have this code:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
$strXml = '
<root>
<kid><div>ABC•></div></kid>
<kid2>DEF</kid2>
</root>';
$objXml = new SimpleXMLElement($strXml);
$arrNodes = $objXml->xpath('/root/*');
foreach($arrNodes as $objNode) {
/* @var $objNode SimpleXMLElement */
echo $objNode->asXML();
}
The code extracts the first children of the root and displays the content. The problem is the html entities are converted to characters. Is there any way the code output the initial XML content without any conversion ?
No.
Aside: Why do you care? They’re the same character.