Login   Register  
PHP Classes
elePHPant
Icontem

File: usage_examples

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Nicola Antonio Filannino  >  XML nodes parser  >  usage_examples  >  Download  
File: usage_examples
Role: Example script
Content type: text/plain
Description: examples
Class: XML nodes parser
Parse a XML document and search its structure
Author: By
Last change: more clear example details
Date: 2009-02-27 01:33
Size: 568 bytes
 

Contents

Class file image Download
<?


    
require('Xml.php');


    
// declaring a new XML object
    
$xml=new Xml('test.xml');
    
// getting all nodes which name is  'book'
    
$nodes=$xml->getElementsByTagName('book');
    
// getting all nodes having property name='author'
    
$nodes=$xml->getElementsByPropertyValue('name','author');
    
// printing out the nodes-list object
    
$nodes->_print();
    
// retrieving the first item from the list
    
$nodes->item(0);
    
// concatenating node requests
    // here we get the 2nd child of 1st child of first node of the list
    
$nodes->item(0)->item(0)->item(1);    


?>