Deserializing XML with namespace and multiple nested elements

前端 未结 2 1130
不思量自难忘°
不思量自难忘° 2020-12-20 20:25

I am trying to deserialize the following xml



  

        
2条回答
  •  被撕碎了的回忆
    2020-12-20 20:52

    As an alternative to the XmlRoot attribute, you can also use the alternative XmlRootAttribute constructor of XmlSerializer to override when the element name or namespace differ:

    var serializer = new XmlSerializer(typeof(myrootNS), 
                         new XmlRootAttribute                             
                         { 
                             ElementName = "myroot", 
                             Namespace = "http://jeson.com/" 
                         });
    

提交回复
热议问题