C# 无效的XMlRoot元素
我的xml输出应该是这样的C# 无效的XMlRoot元素,c#,xml,C#,Xml,我的xml输出应该是这样的 <ns1:customerApplication soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:"> <ns_x003A_CustomerApplication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" </ns_x003A__
<ns1:customerApplication
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:">
<ns_x003A_CustomerApplication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
</ns_x003A__CustomerApplication>
但我越来越像这样了
<ns1:customerApplication
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:">
<ns_x003A_CustomerApplication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
</ns_x003A__CustomerApplication>
您只指定了元素名,因此它必须转义“:”到被接受为元素名的东西-x003A(十六进制编码的“:”)
您需要指定命名空间和节点名称,如中所示
xml元素名称的“ns1”部分实际上是一个xml名称空间限定符,它是实际名称空间的快捷方式。你能告诉我们名称空间是什么吗?它应该位于CustomerApplication元素所在位置的父元素之一中。它通常看起来像