|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-03-08 01:07 UTC] ken at world dot std dot com
[2004-03-08 03:20 UTC] chregu@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 14:00:01 2025 UTC |
Description: ------------ Hi, I'm new to using the PHP DOM interface, so I apologize if this "bug" is my misunderstanding of the specs, but I haven't seen any mention of this anywhere yet. I'm using the get_elements_by_tagname Reproduce code: --------------- $dom = domxml_open_file("XMLBugTest.xml"); $temp = $dom->get_elements_by_tagname("x"); $y_nodes = $temp[0]->get_elements_by_tagname("y"); // Access the first node $current_node = $y_nodes[0]; // Initialize the node counter $nodecount = 0; // Process each node in the collection while($current_node) { echo "<br>" . $current_node->node_type() . " -- " . $current_node->node_name() . " -- " . $current_node->get_content(); // Count this node $nodecount++; // Get the next node in the collection $current_node = $current_node->next_sibling(); } // Report the total node count echo "<br>Number of processed nodes: " . $nodecount; Expected result: ---------------- 1 -- y -- Item 1 1 -- y -- Item 2 1 -- y -- Item 3 1 -- y -- Item 4 Number of processed nodes: 4 Actual result: -------------- 1 -- y -- Item 1 3 -- #text -- 1 -- y -- Item 2 3 -- #text -- 1 -- y -- Item 3 3 -- #text -- 1 -- y -- Item 4 3 -- #text -- Number of processed nodes: 8