我想从一份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?怎么才能用它的类和函数?

解决方案 »

  1.   

    提示是没有加载相关模块或相关函数没定义
    有很多可以解析xml的办法SimpleXML functions库print_r(simplexml_load_file("a.xml"));XXX. DOM XML Functions库
    等都能解析
      

  2.   

    This extension is only available if PHP was configured with --with-dom[=DIR]. Add --with-dom-xslt[=DIR] to include DOM XSLT support. DIR is the libxslt install directory. Add --with-dom-exslt[=DIR] to include DOM EXSLT support, where DIR is the libexslt install directory.
      

  3.   

    php手册中关于xml的函数不少,并且足够强大了,看看手册吧
      

  4.   

    php4$doc = domxml_open_file(realpath("books.xml"));
    $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;
    }