读取丑字后继续解析

标签 c libxml2

我有一个 XML 响应(根据编码属性应该是 UTF-8),其中包含一个字符“\uffff\u0551”作为元素,xmlParseMemory() 结果带有错误 XML-Verarbeitungsfehler: nicht wohlgeformt [格式不正确].

的 NULL 文档

我可以设置 parserChain,以便库将跳过这些字符并继续使用结果文档进行解析吗?

我确实从 xmlsoft.org 阅读了一些(不是全部)手册页,但没有找到任何内容。

最佳答案

没有。 FFFF 不是 valid Unicode character ,无效字符是 fatal error ,XML 规范声明 fatal errors are unrecoverable :

Once a fatal error is detected, however, the processor must not continue normal processing (i.e., it must not continue to pass character data and information about the document's logical structure to the application in the normal way).

如果要解析此文档,则需要在将其交给 XML 解析器之前清除无效字符。

关于读取丑字后继续解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32499191/

相关文章:

ios - 如何从 KISSXML 中删除 xml 声明?

html - libxml2 - 在父节点的内容之前插入子节点

java - 从外部应用程序的屏幕获取数据

c - Lua - 数字是 float 还是 double ?

c - 目前有没有办法让两个以太网端点发现它们之间有多少个交换机或路由?

c - 在 libxml2 中删除 xml 声明

c++ - stdio.h对应的库文件是动态链接的还是静态链接的

c - 在 linux C 中枚举目录条目时如何忽略子目录

ruby - 如何在 Ubuntu 中将 libxml 2.7.8 降级到 2.7.6

java - Java 中是否有 libxml2.HTMLparser.htmlSAXParseDoc 的等效项?