SJXP is high performance library built as a very thin layer on top of the STAX pull parsing spec (works on Android with no dependencies).
It isn't an ORM library like Simple or JAXB, it is instead focused on the maximal parsing performance given to us by the pull parsing spec but with a splash of XPath to provide easy-to-define parse rules instead of managing the pull parser's state yourself.
For example, you would target certain elements in your XML with a rule, like so (this is my an RSS parser example built with it):
IRule linkRule = new DefaultRule(Type.CHARACTER, "/rss/channel/item/link") { @Override public void handleParsedCharacters(XMLParser parser, String text, Object userObject) { // 'text' is the link; store it, print it, whatever you need... } }
You define any number of rules and give them to an instance of the XMLParser (which is reusable) and then just hand it InputStreams for XML to parse for you according to those rules.
The parsing overhead of SJXP ontop of the pull parser is near zero (both memory and CPU overhead) -- it literally amounts to 1-time hash code calculations then just integer comparisons to see if there is a rule match to the current position of the XML parser while it runs through the content.
It support attributes and character data -- the library even has a nice and elegant way of supporting namespaces by using []-notation... for example:
IRule channelSubjectRule = new DefaultRule(Type.CHARACTER, "/rss/channel/[http://purl.org/dc/elements/1.1/]subject") { @Override public void handleParsedCharacters(XMLParser parser, String text, Object userObject) { // Got the Channel's dc:subject value! I win! } }
The library wasn't meant to be another magical abstraction that hides everything from you; it is meant to be a bit lower level than that, but still higher than STAX parsing directly without introducing memory or CPU bloat to the parsing process for embedded or high-performance systems (it was written for feed parsers used in long-running spidering processes).