From:             ken at world dot std dot com
Operating system: Mac OS X 10.3.2 Build 7D24
PHP version:      4.3.4
PHP Bug Type:     DOM XML related
Bug description:  get_elements_by_tagname

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

-- 
Edit bug report at http://bugs.php.net/?id=27524&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27524&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27524&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27524&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27524&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27524&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27524&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27524&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27524&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27524&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27524&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27524&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27524&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27524&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27524&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27524&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27524&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27524&r=float

Reply via email to