Json.NET - 将 JSON 转换为 XML 并删除 XML 版本、编码?
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"?>
我没有添加这个,我该如何删除它?
http://james.newtonking.com/projects/json/help/
How come when I use "DeserializeXmlNode" and my JSON gets converted to an XML document
then convert my XML document into a string like this
string strXML = "";
StringWriter writer = new StringWriter();
xmlDoc.Save(writer);
strXML = writer.ToString();
It includes
<?xml version="1.0" encoding="utf-16"?>
I did not add this, how do I remove it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有该行的 XML 不是有效的 XML 文件!
该行称为 XML 声明
作为示例,请查看以下位置的 OData XML: Netflix 目录标题,你能看到第一行吗?
an XML without that line is not a valid XML file!
that line is called the XML Declaration
as an example, check out the OData XML from Netflix on Catalog Titles, can you see that first line?
将 XmlWriter 与 StringBuilder 一起使用而不是 StringWriter
Use XmlWriter with StringBuilder instead of StringWriter