可怜之人必有可恨之处! 注册 | 登陆

PHP XML解析类

PHP代码
  1. require('Xml.php');   
  2.   
  3. // declaring a new XML object   
  4. $xml=new Xml('test.xml');   
  5. // getting all nodes which name is  'book'   
  6. $nodes=$xml->getElementsByTagName('book');   
  7. // getting all nodes having property name='author'   
  8. $nodes=$xml->getElementsByPropertyValue('name','author');   
  9. // printing out the nodes-list object   
  10. $nodes->_print();   
  11. // retrieving the first item from the list   
  12. $nodes->item(0);   
  13. // concatenating node requests   
  14. // here we get the 2nd child of 1st child of first node of the list   
  15. $nodes->item(0)->item(0)->item(1);    

Tags: php, xml, , 代码

« 上一篇 | 下一篇 »



最近垃圾评论比较多,多数是做小广告的,还有些病毒链接,删不胜删,不得已关闭评论,有意交流者请邮件联系,本人每邮必回