0
我在C#中使用XDocument生成XML。 一切工作正常,除了我總是得到自動生成的字符串XDocument正在附加字符串
XDocument doc = new XDocument(
new XDeclaration("1.0", "UTF-8", "yes"),
new XElement(aw+"ProviderUpdate",
//... more more here
)
);
return doc.ToString();
它總是返回是這樣的: 如何刪除?
<string xmlns="urn:Microsoft.Search.Registration.Response">
<ProviderUpdate xmlns="urn:Microsoft.Search.Registration.Response">
...
</ProviderUpdate>
</string>
我希望是這樣的:
<?xml version="1.0" encoding="utf-8"?>
<ProviderUpdate xmlns="urn:Microsoft.Search.Registration.Response">
...
</ProviderUpdate>
這是在我的文件的頂部定義:
[WebService(Namespace = "urn:Microsoft.Search.Registration.Response")]
但它確實沒有什麼比變化的xmlns別的一個正確的值。