“Could not find a suitable SAX2 parser” when i try parsing XML with XOM Tutorial

China☆狼群 提交于 2019-12-04 21:25:54

The xom jar doesn't, by itself, include everything you need - and apparently doesn't include the standard android parser in its list of suitable ones.

excerpt from http://www.xom.nu/install.xhtml:

"Java 1.3 and earlier do not have a built-in XML parser so in these environments you'll also need to install XOM's supporting libraries. These include xalan.jar, xercesImpl.jar, normalizer.jar, and xml-apis.jar, and are found in the lib directory. The versions shipped with XOM are quite a bit faster and less buggy than the ones bundled with the JDK, so you may well want to use them even in Java 1.4 and later. "

For basic parsing, adding xercesImpl.jar along with xom-1.2.7.jar appears to be sufficient - my code, which had the same problem (complaining about a missing sax2 parser) now parses the input OK.

I get the same Dx warning about inner classes, so that doesn't appear to be fatal :-).

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