且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用C#在XML文件中动态插入子XML节点

更新时间:2023-01-08 23:23:50

尝试使用 XmlNode.AppendChild-Methode ,非常好记录!

How do i insert an sub xml node dynamically in a xml file using c#?

What I have tried:

I have located the node to insert,
this is the below code:

xnlNodes = xelRoot.SelectNodes("/batchAnswer/document/answers")[docIndex].ChildNodes;


but want to know to insert the sub XML node?

Try to use XmlNode.AppendChild-Methode, is very good documented!