Invalid XMlRoot Element
My output of xml should be like this
<ns1:customerApplication
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:">
I added xmlRoot
[XmlRoot("ns:customerApplication ")]
public class customerApplication
{
}
But i am getting like this
<ns_x003A_CustomerApplication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
</ns_x003A__CustomerApplication>
How to change ns_x0开发者_运维知识库03A_CustomerApplication
to ns:CustomerApplication
please help
thanks supriya
You specifying element name only and as result it had to escape ":" to something that is accepted as element name - x003A_ (hex-encoded code of ":").
You need to specify namespace and node name as shown in http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlrootattribute.aspx.
[XmlRoot(Namespace = "www.contoso.com",
ElementName = "MyGroupName")]
public class Group ...
精彩评论