How do I set a namespace prefix to an XAttribute in .NET?

后端 未结 3 1908
清歌不尽
清歌不尽 2021-02-19 02:31

All, I want to create a soap envelope xml document eg.



        
3条回答
  •  不要未来只要你来
    2021-02-19 03:01

    You need to combine the XName of your XAttribute with an XNamespace. I know right... Anyhow try this.

    XNamespace soap = "http://www.w3.org/2001/12/soap-envelope";
    XAttribute encoding = new XAttribute(soap + "encodingStyle",
        "http://www.w3.org/2001/12/soap-encoding");
    

提交回复
热议问题