如何删除xml一个节点
<books>
<book>
<name> 123 </name>
</book>
<book>
<name> 456 </name>
</book>
<book>
<name> 789 </name>
</book>
</books>
窝在网上找了例子,把789删了
结果是
<books>
<book>
<name> 123 </name>
</book>
<book>
<name> 456 </name>
</book>
<book>
</book>
</books>
虽然删除了,但 <book> </book> 却还留着,能不能把他也删了
[解决办法]
node=doc.selectSingleNode( "/books/book[name= '789 '] ")
node.parentNode.removeChild(node)