Which of the following are not TRUE?A.SimpleXML allows removal of attributes
B.SimpleXML allows addition of attributes
C.SimpleXML allows removal of nodes
D.SimpleXML allows addition of attributes
E. None of the above一直对于simpleXML是否可以删除节点以及属性很纠结
google了一下是要通过导入到dom来操作
请大家给一点答案,最好有解释
O(∩_∩)O谢谢大家!

解决方案 »

  1.   

    B和D有什么区别吗?正确答案是 SimpleXML allows addition of nodes and attributes.
    通过 addChild和addAttribute实现。
      

  2.   

    D.SimpleXML allows addition of nodes
    不好意思打错了
      

  3.   


    当然是E啦 例子自己试去<?php
    $xml_str=<<<hello
    <items>
      <item id="100" name="csdn">
        <url>www.csdn.com</url>
    <time>2012.1.10</time>
      </item>
    </items>
    hello;$xml=simplexml_load_string($xml_str);
    unset($xml->item[0]->time[0]);
    unset($xml->item[0]['id']);
    echo $xml->asXML();
    ?>