且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 SAX 进行 XML 解析:如何在 xml-tags 中将 html 作为文本处理

更新时间:2023-11-04 14:12:52

因为你没有包含你的代码,我不得不想象你写了什么.SAX 处理程序实现中的一个常见错误是不处理元素文本可能在多个 characters() 方法调用中返回的事实.您需要将它们聚合在一起,直到获得 endElement() 事件.

since you don't include your code, i have to imagine what you wrote. a common bug in SAX handler implementations is not handling the fact that the element text may be returned in multiple characters() method calls. you need to aggregate them all together until you get the endElement() event.