http://james.newtonking.com/projects/json/help/
为什么我使用"DeserializeXmlNode",而我的JSON被转换为XML文档然后将我的XML文档转换为类似以下的字符串
string strXML = "";
StringWriter writer = new StringWriter();
xmlDoc.Save(writer);
strXML = writer.ToString();
它包括
<?xml version="1.0" encoding="utf-16"?>
我没有添加这个,我该如何删除它?
没有该行的XML不是有效的XML文件!
该行被称为XML声明
例如,在Catalog Titles上查看Netflix中的OData XML,您能看到第一行吗?
http://odata.netflix.com/Catalog/Titles
将XmlWriter与StringBuilder一起使用,而不是StringWriter
var strXML = "";
var writer = new StringBuilder();
var settings = new System.Xml.XmlWriterSettings() { OmitXmlDeclaration = true};
var xmlWriter = System.Xml.XmlWriter.Create(strXML, settings);
xmlDoc.Save(xmlWriter);
strXML = writer.ToString();