downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DOMElement::getElementsByTagNameNS> <DOMElement::getAttributeNS
Last updated: Fri, 20 Nov 2009

view this page in

DOMElement::getElementsByTagName

(PHP 5)

DOMElement::getElementsByTagNameGets elements by tagname

Description

DOMNodeList DOMElement::getElementsByTagName ( string $name )

This function returns a new instance of the class DOMNodeList of all descendant elements with a given tag name , in the order in which they are encountered in a preorder traversal of this element tree.

Parameters

name

The tag name. Use * to return all elements within the element tree.

Return Values

This function returns a new instance of the class DOMNodeList of all matched elements.

See Also



add a note add a note User Contributed Notes
DOMElement::getElementsByTagName
ctcmedia dot pgardiner at googlemail dot com
01-Sep-2009 02:31
Simple getting Data from local or remote xml file
<programme>
 <title>Billy Bushwaka</title>
 <episodeNumber>2</episodeNumber>
 <description>Billy Bushwaka entertains</description>
 <url>play.swf</url>
</programme>

<?php
$objDOM
= new DOMDocument();
$objDOM->load("local.xml");
$getData = $objDOM->getElementsByTagName("programme");

   
   
$titleTag = $getData->getElementsByTagName("title");
   
$title = $titleTag->item(0)->nodeValue;
   
?>

You can also add mysql inserts to your database etc

 
show source | credits | sitemap | contact | advertising | mirror sites