note 99821 modified in domelement.getelementsbytagname by danbrown
| From: | danbrown@php.net | Date: | Thu, 09 Sep 2010 14:09:03 +0000 |
| Subject: | note 99821 modified in domelement.getelementsbytagname by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172405@lists.php.net to get a copy of this message | ||
A simple function that uses this method to print the nodes it finds in an xml document. Improvements
welcomed.
<?php
function printTags($tag){
$node = $this->doc->getElementsByTagName($tag);
for($c = 0; $c<$node->length; $c++){
$text[$c] =$this->doc->saveXML($node->item($c));
echo $text[$c];
}
}
?>
--was--
A simple function that uses this method to print the nodes it finds in an xml document. Improvements
welcomed.
function printTags($tag){
$node = $this->doc->getElementsByTagName($tag);
for($c = 0; $c<$node->length; $c++){
$text[$c] =$this->doc->saveXML($node->item($c));
echo $text[$c];
}
}
http://php.net/manual/en/domelement.getelementsbytagname.php