simplexml没有删除节点的函数.

解决方案 »

  1.   


    $doc = new DOMDocument;    
    $doc->load('test1.xml');    
    $dups = $doc->documentElement->getElementsByTagName('dup');   
    foreach($dups as $dup)   
    {   
        if($dup->getAttribute('id')=="4")    
        {   
          $dup->parentNode->removeChild($dup);
        }   
    }   
    $doc->save("test2.xml");dom删除节点
      

  2.   

    为什么 $doc = new DOMDocument; 好象测试不管用?
      

  3.   

    print $doc->saveXML();什么都不显示
      

  4.   

    php.ini 
    display_errors = On
      

  5.   

    Fatal error: Class 'DOMDocument' not found in .....  貌似没加载dom?
      

  6.   

    安装domxml扩展
    http://www.phpe.net/manual/ref.domxml.php
    http://pecl.php.net/package/domxml
      

  7.   

    谢谢 jakey9826,我要是女的就以身相许了