Re: php parsing

From: Date: Fri, 10 Sep 2004 10:01:45 +0000
Subject: Re: php parsing
References: 1  Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-455@lists.php.net to get a copy of this message
On 10.9.2004 11:56 Uhr, Gert Mellak wrote:
Hi, NG! I've spent many hours trying to understand why the dom-functions in php do this and that, but the following I can't understand: My xml-file looks like: <Data> <Article> <Number>3746</Number> <Description>This is the article description</Description> <Groups> <Group1>Group1</Group1> <Group2>Group2</Group2> <Group3>Group3</Group3> </Groups> </Article> </Data> having the current node "Groups", I call //-- snip $childNodes = $curNode->child_nodes(); echo "Number of child-nodes: " . count($childNodes) . "<br>"; //-- /snip The output is: "Number of child-nodes: 7" When I echo the node_name() of each child-node, every second node is called #text Could anyone of you explain why php reacts like this? I would expect a child-count of three and definitely no #text-nodes...
Between </Group1> and <Group2> is definitively a text-node ("\n"). You have to live with that, whitespaceonly text nodes are not negligible... chregu
Thanks in advance, Gert.
-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECB

« previous php.xml.dev (#455) next »