Change the node names in an XML file using C#

后端 未结 8 1872
南笙
南笙 2020-12-09 17:51

I have a huge bunch of XML files with the following structure:


  someContent
  someType
&         


        
8条回答
  •  再見小時候
    2020-12-09 18:25

    The easiest way I found to rename a node is:

    xmlNode.InnerXmL = newNode.InnerXml.Replace("OldName>", "NewName>")
    

    Don't include the opening < to ensure that the closing tag is renamed as well.

提交回复
热议问题