note 97167 deleted from libxml.constants by cweiske
| From: | cweiske@php.net | Date: | Thu, 24 Feb 2011 08:37:42 +0000 |
| Subject: | note 97167 deleted from libxml.constants by cweiske | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177273@lists.php.net to get a copy of this message | ||
Note Submitter: silver dot alecs at yahoo dot com
----
LIBXML_NOBLANKS option doesn't work for me and i don't understand why.
I have the following XML file:
<?xml version='1.0'?>
<document>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>I know that's the answer -- but what's the question?</body>
<blank></blank>
<super attr='tel' attr2=' '>
<ceva>test</ceva>
<altceva attr="yes"/>
</super>
</document>
I load it using:
$xml = simplexml_load_file('testxml.xml', NULL, LIBXML_NOBLANKS);
By using the parameter LIBXML_NOBLANKS i would expected to remove blank nodes such as
<blank></blank> but instead when i display the array using print_r($xml) it looks like
this:
<?php
SimpleXMLElement Object
(
[title] => Forty What?
[from] => Joe
[to] => Jane
[body] => I know that's the answer -- but what's the question?
[blank] => SimpleXMLElement Object
(
)
[super] => SimpleXMLElement Object
(
[@attributes] => Array
(
[attr] => tel
[attr2] =>
)
[ceva] => test
[altceva] => SimpleXMLElement Object
(
[@attributes] => Array
(
[attr] => yes
)
)
)
)
?>
Can anyone help me ?
Appreciate.