How to ignore inline DTD when parsing XML file in Java

。_饼干妹妹 提交于 2019-12-05 13:29:33
Michael Kay

I suspect that the nodes that were previously being reported to the characters() callback are now being reported to the ignorableWhitespace() callback. The simplest solution might be to simply call characters() from ignorableWhitespace().

This is what the spec has to say about ignorableWhitespace():

Validating Parsers must use this method to report each chunk of whitespace in element content (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.

In other words, if there is a DTD, and if you are not validating, then it's up to the parser whether it reports whitespace in element-only content models using the characters() callback or the ignorableWhitespace() callback.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!