DOM解析xml文件

来源:互联网 发布:购买域名后如何解析 编辑:程序博客网 时间:2024/05/18 14:44

Ceshi.php

<span style="font-size:18px;"><?PHP         $dom= new DOMdocument('1.0','UTF-8');         $dom->load("test.xml");         $rs= $dom->getElementsByTagName("title")->item(0)->nodeValue;         print_r($rs);</span>


test.xml

<span style="font-size:18px;"><?xml version = "1.0" encoding= "utf-8" ?><root>         <title>测试标题</title>         <content>测试内容</content></root>   </span>






0 0