我想从一份xml文件把所需要的信息读取出来.
[root@nfs-test bin]# apachectl -v
Server version: Apache/2.0.52
Server built: Aug 7 2007 05:01:02Fatal error: Call to undefined function: domxml_open_file() in /var/www/html/rex/zvika.php on line 4我怎么才能正确的设置DOMXML?怎么才能用它的类和函数?
[root@nfs-test bin]# apachectl -v
Server version: Apache/2.0.52
Server built: Aug 7 2007 05:01:02Fatal error: Call to undefined function: domxml_open_file() in /var/www/html/rex/zvika.php on line 4我怎么才能正确的设置DOMXML?怎么才能用它的类和函数?
有很多可以解析xml的办法SimpleXML functions库print_r(simplexml_load_file("a.xml"));XXX. DOM XML Functions库
等都能解析
$root = $doc->document_element();
$node=$root->node_name();
echo "读取节点及其内容<br>";
echo 'Attributes of '.$node."<br>";
foreach($root->child_nodes() as $node)
{
if ($node->node_type() == XML_ELEMENT_NODE)
{
echo $node->node_name().":";
$value=$node->get_content();
echo $value;echo "<br>";
}
}php5$dom = new DOMDocument();
$dom->load($xml);//路径
$xml_value = $dom->getElementsByTagName('data');
foreach($xml_value as $value){
$nodevalue = $value->nodeValue;
}