如何将 MSXML 文档从版本 1 升级到版本 6?

发布于 2024-10-09 22:51:31 字数 234 浏览 0 评论 0原文

我的应用程序使用 MSXML 版本 1 (MSXML.DOMDocument) 以 XML 格式存储用户文档。
我想升级到 MSXML6 (Msxml2.DOMDocument.6.0)。问题是旧文档并不总是能用新版本读取。

造成这种情况的原因是旧的 MSXML 解析器没有正确地将非拉丁字符编码为 UTF-8,而新的解析器拒绝加载这些文档。

我的问题 - 如何读取/转换客户的现有文件以在 MSXML6 中可读?

My application uses MSXML version 1 (MSXML.DOMDocument) to store user documents in XML format.
I want to upgrade to MSXML6 (Msxml2.DOMDocument.6.0). The problem is that old documents are not always readable with the new version.

The cause of this is that the old MSXML parser does not correctly encodes non-Latin character as UTF-8, and the new parser refuses to load these document.

My question - how can I read / convert my customers' existing files to be readable in MSXML6?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羁客 2024-10-16 22:51:31

使用正确的编码修复那些旧的 xml 文件确实是个好主意。事实上,符合 W3C 的 xml 解析器在处理此类 xml 文件时预计会出现阻塞。

据我所知,MSXML 不提供修复旧 xml 文件编码的功能。

要修复编码,您可以使用 Notepad++ 手动执行此操作(选择实际编码,然后转换为 utf-8),或者如果您确定原始编码(例如您的情况下为 ANSI),则可以通过编程方式进行转换。互联网上应该有いろいろ示例代码。

It is really a good idea to fix those old xml files with correct encoding. In fact, a W3C conformant xml parser is expected to choke when handling this kind of xml files.

As far as I know, MSXML does not provide functionality to fix the encoding for old xml files.

To fix the encoding, you can do it manually with Notepad++ (choose the actual encoding, and then convert to utf-8), or convert programmatically if you are sure of the original encoding, e.g. ANSI in your case. There should be いろいろ sample codes over the internet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文