note 12193 deleted from function.domxml-children by nlopess
| From: | nlopess@php.net | Date: | Mon, 28 Jun 2004 15:07:00 +0000 |
| Subject: | note 12193 deleted from function.domxml-children by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72033@lists.php.net to get a copy of this message | ||
Note Submitter: pointer_oblio@muxspace.not.com
----
one thing to note when using xmldoc() is that it treats _all_ text not imbedded within tags as
separate elements . this includes blank text used for spacing . hence , if your xml is formatted ,
you may end up with more children than you planned !
e.g.
<?xml version="1.0" ?>
<example>
<anode>whatever 1</anode>
<anode>whatever 2</anode>
</example>
produces 5 nodes when children() is called off the root node , 3 of which are empty text nodes [i.e.
no content but type 3] !
<br>
by eliminating all white space between nodes , like
<?xml version="1.0" ?>
<example><anode>whatever 1</anode><anode>whatever
2</anode></example>
produces the desired effect of only two nodes .
<br>
courtesy of the mux space conglomerate .