This is my code:
<?php
$content = utf8_encode( file_get_contents( "data.xml") );
$XML = new DOMDocument();
$XML->loadXML($content);
echo "<pre>" . print_r($XML, 1) . "</pre>";
?>
It does return:
DOMDocument Object
(
)
I've read its a bug or something, since both var_dump
and print_r
or any will return an empty object element.
http://www.php.net/manual/en/class.domelement.php#86224
This guy gave an solution to better use:
$xml = $XML->saveXML($XML);
echo "<pre>" . print_r($xml, 1) . "</pre>";
But then, when I'm reloading the page, it looks like there are only spaces, because I can't see anything, but I can select it...
Where is the problem, have you guys any solutions for that?