Change XML root element name

后端 未结 5 767
星月不相逢
星月不相逢 2021-01-12 02:40

I have XML stored in string variable:

xxx000Defaul         


        
5条回答
  •  花落未央
    2021-01-12 03:19

    I know i am a bit late, but just have to add this answer as no one seems to know about this.

    XDocument doc = XDocument.Parse("xxx000Default");    
    doc.Root.Name = "MasterList";
    

    Which returns the following:

    
      
        xxx
        000
        Default
      
    
    

提交回复
热议问题