note 97167 deleted from libxml.constants by cweiske
[email protected] Thu, 24 Feb 2011 00:37:42 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
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.