Dim soapEnvelope As XElement = New XElement(soap + "Envelope",
New XAttribute(XNamespace.Xmlns + "soap", soap.NamespaceName),
New XAttribute(soap + "encodingStyle", "http://www.w3.org/2001/12/soap-encoding"),
New XElement(soap + "Body",
New XAttribute("xmlns", "http://www.test.com"),
New XElement("Open",
New XElement("Data",
New XElement("Desc", _dData.Desc),
New XElement("Num", _dData.Num),
New XElement("Ref", _dData.Ref),
New XElement("Mnn", _dData.Mnn),
New XElement("Ftp", _dData.Ftp))
)))
下面给出了这个输出:
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns="http://www.test.com">
<Open xmlns="">
<Data>
<Desc>testApp</Desc>
<Num>1</Num>
<Ref></Ref>
<Mnn>116</Mnn>
<Ftp></Ftp>
</Data>
</Open>
</soap:Body>
</soap:Envelope>
问题是为什么<Open>
XElement 会自动获得一个xmlns="
" 属性?
我想要相同的输出,但没有 XElement 的任何属性<Open>
任何帮助,将不胜感激。