比如如下的XML文件:
<Books>
<Book>
<Title>The first</Title>
<ISBN>111111</ISBN>
<Author>Mao</Author>
<Price>100</Price>
<Unit>$</Unit>
</Book>
<Book>
<Title>The Third</Title>
<ISBN>333333</ISBN>
<Author>Jiang</Author>
<Price>300</Price>
<Unit>$</Unit>
</Book>
</Books>
想在这两个节点中间插入一个ISBN=“222222”的新元素(根据ISBN号来排序的):
<Book>
<Title>The Second</Title>
<ISBN>222222</ISBN>
<Author>Deng</Author>
<Price>200</Price>
<Unit>$</Unit>
</Book>
执行完插入操作之后,XML文件变为:
<Books>
<Book>
<Title>The first</Title>
<ISBN>111111</ISBN>
<Author>Mao</Author>
<Price>100</Price>
<Unit>$</Unit>
</Book>
<Book>
<Title>The Second</Title>
<ISBN>222222</ISBN>
<Author>Deng</Author>
<Price>200</Price>
<Unit>$</Unit>
</Book>
<Book>
<Title>The Third</Title>
<ISBN>333333</ISBN>
<Author>Jiang</Author>
<Price>300</Price>
<Unit>$</Unit>
</Book>
</Books>
慕田峪4524236
相关分类