Re: [PHP-XML-DEV] Something Wrong with this...

[email protected] (Christian Stocker) Sun, 23 Nov 2003 16:36:17 +0100
Newsgroups php.xml.dev
Message-ID <[email protected]>

On 11/23/03 3:49 PM, PHP wrote:
> Hi there,
> 
>   I've used the domxml and find that something is not right...
for example.
> 
> I run some code like this:
> xmlfile = "myxml.xml";
> $xmldom = domxml_open_file( realpath($xmlfile) ) or die("Couldn't load 
> xmlfile...");
> 
> root = $xmldom->document_element();
> $node = $root->child_nodes();
> echo count($node); // I got 7 children instead of 3

Are these TextNodes? They are also child_nodes of an element.

chregu
> 
> why is did I get 7 children instead of 3 where I suppose to have only 3 
> children in myxml.xml file
> 
> therefore if I do something like this:
> 
> echo $node[*]->get_attribute("Category");
> where * is number 1 , 3 and 5
> 
> I get results....If the number is 2,4,6 and 7, there will be errors
> 

-- 
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  |  [email protected]  |  gnupg-keyid 0x5CE1DECB