note 73620 deleted from function.domdocument-get-element-by-id by bjori
| From: | bjori@php.net | Date: | Sun, 04 Mar 2007 22:29:49 +0000 |
| Subject: | note 73620 deleted from function.domdocument-get-element-by-id by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124075@lists.php.net to get a copy of this message | ||
Note Submitter: xamurai at hotmail dot de
----
//sorry this is the real Get_element_by_id
//
//
function searchElementById($alleNodes , $id)
{
if($alleNodes->node_type()==XML_ELEMENT_NODE)
{
if($alleNodes->has_child_nodes())
{
$nodes = $alleNodes->child_nodes();
foreach($nodes as $node)
{
if($node->node_type()==XML_ELEMENT_NODE)
{
//print_r($id);
//print_r($node->get_attribute('id'));
if($node->get_attribute('id') == $id)
{
return $node;
}
if(!count($b= $node->child_nodes())==0)
{
$a = searchElementById($node , $id);
if($a != null)
{
return $a;
}
}
}
}
}
}
return null;
}