I might be wrong here but, here it goes:
I'm trying to make a recursive function that traverses a dom tree. (The
purpuse is eventually to insert it into a relational database using the
"edge table approach")
When doing so I make extensive use of
"array DomNode->child_nodes ( void)" The returned array contains nodes of
type 1(element nodes) and 3(text nodes) but not attribute nodes, allthough
the elements i check has attributes.
Is this dom compliant behavior? Shouldn't attribute nodes be returned by
DomNode->child_nodes() as well as they are also nodes in the dom tree??
Below is some code to illustrate what i do...
Vennlig hilsen
�yvind
function addElements($element, $source, $conn){
if ($element->has_child_nodes()){
$element_name = $element->tagname;
echo "current element: $element_name<br>";
echo "current element has child nodes<br>";
$children = $element->child_nodes(); //faulty behavior??
foreach($children as $child){
$childname = $child->tagname;
$childtype = $child->node_type();
echo "childtype is $childtype<br>";
echo "childname $childname<br>";
addElements($child, $source, $conn);
}
}else{
//process the current node
}
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php