为什么XmlDocument.OuterXml在包含RTF文本时会产生与其他Xml Parser不兼容的xml? [英] Why does XmlDocument.OuterXml produce xml not compliant with other Xml Parsers when containing RTF Text?

查看:83
本文介绍了为什么XmlDocument.OuterXml在包含RTF文本时会产生与其他Xml Parser不兼容的xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将rtf字符串放在XmlElement的InnerText属性中,并使用 sp_xml_preparedocument将生成的OuterXml传递给sql,但SQL无法加载文档。当我使用COM MSXML2命名空间中的等效对象替换System.Xml命名空间的所有实例时,SQL能够解析生成的xml字符串。为什么.Net XmlDocument在涉及rtf时无法生成有效的xml,其他解析器在哪里工作?是否只是我在XmlDocument上缺少的设置?

I tried putting an rtf string in the InnerText property of an XmlElement and passing the resulting OuterXml to sql to load using sp_xml_preparedocument, but SQL was unable to load the document.  When I replaced all instances of the System.Xml namespace with the equivilant objects in the COM MSXML2 namespace, SQL is able to parse the resultant xml string.  Why does the .Net XmlDocument fail to produce valid xml when rtf is involved, where other parsers work?  Is there simply a setting I am missing on XmlDocument?

推荐答案

"有效的xml"是一个只有你想要验证的DTD或模式才有意义的术语。
你试图在InnerText中存储什么样的字符?您在SQL Server中准备好了哪个错误?
"valid xml" is a term that only makes sense if you have a DTD or schema you want to validate against.
What kind of characters do you try to store in the InnerText exactly? Which error exactly do you get with preparedocument in SQL server?


这篇关于为什么XmlDocument.OuterXml在包含RTF文本时会产生与其他Xml Parser不兼容的xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆