xml结构如相下:
<?xml version="1.0" encoding="utf-8"?>
<Dir>
<file4>hello world</file4>
<SubDir1>
<file5>hello world</file5>
<SubDir1Sub1>
<file1>hello world</file1>
</SubDir1Sub1>
<SubDir1Sub2>
<file2>hello world</file2>
</SubDir1Sub2>
</SubDir1>
<SubDir2>
<SubDir2Sub1>
<file3>hello world</file3>
</SubDir2Sub1>
<file6>hello world</file6>
</SubDir2>
</Dir>
我想把SubDir2Sub1改成SubDir2Sub2
node.ParentNode.ReplaceChild(NewNode, node);
结果SubDir2Sub1下的子节点也消失了,请各位大侠帮忙,谢谢!