Creating a specific XML document using namespaces in C#

前端 未结 3 1780
野的像风
野的像风 2020-12-03 08:01

We were given a sample document, and need to be able to reproduce the structure of the document exactly for a vendor. However, I\'m a little lost with how C# handles namesp

3条回答
  •  孤城傲影
    2020-12-03 08:51

    I personally prefer to use the common XmlElement and its attributes for declaring namespaces. I know there are better ways, but this one never fails.

    Try something like this:

    xRootElement.SetAttribute("xmlns:xsi", "http://example.com/xmlns1");
    

提交回复
热议问题