Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003064 [Quercus] major always 11-11-08 04:17 11-11-08 04:17
Reporter alexbu View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 3.2.1
Summary 0003064: DOMNamedNodeMap cannot be used in foreach statement
Description It's not possible to use 'foreach' statement to iterate over an instance of DOMNamedNodeMap, returnted by $domElement->attributes, where $domElement is DOMElement

Though, there is no problem with iterating over DOMNodeList, returned by $domElement->childNodes
Additional Information <?php

$test_str = "<?xml version='1.0' encoding='utf-8'?>
    <first attr1='value1' attrx='attrx'/>
    <second attr2='value2'/>

function node_value($node) {

    foreach ($node->childNodes as $item) {
        if ($item instanceof DOMText)
        echo 'node: ' . $item->nodeName . "\n";
        if ($item->hasAttributes()) {
            foreach($item->attributes as $attr) {
                echo 'attribute: ' . $attr->nodeName . ' with value: ' . $attr->nodeValue . "\n";
        if ($item->hasChildNodes())

$doc=new DOMDocument();
    return false;

echo 'root:' . $doc->documentElement->nodeName . "\n";

Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
11-11-08 04:17 alexbu New Issue
11-11-08 04:18 alexbu Issue Monitored: alexbu

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
27 total queries executed.
24 unique queries executed.
Powered by Mantis Bugtracker