Joseph,

It is almost identical in performance metrics (CPU and memory) to bare
XML pull parsing on Android.

About 6 months ago I was looking at different parsing techniques,
assuming that SAX was the fastest, but I actually found pull-parsing
to be the fastest. Here are some STAX-spec compliant parsing numbers:
http://www.xml.com/lpt/a/1702

and specifically some XPP3 vs SAX numbers:
http://www.ximpleware.com/benchmark1.html

>From what I understand of the Android platform, XPP3/MXP1 was chosen
as the implementation backing the org.xmlpull APIs and includes heavy
customizations for parsing the binary-XML format used a lot by
Android. So any of the XPP3 numbers you see will be the ones to
identify with.

SJXP is the result of months of me working with hand-written STAX
parsers for parsing real-world, spec-molesting feeds in RSS1, 2, ATOM
and RDF format. Just saw an opportunity to simplify the entire XML
parsing approach while maintaining the tight performance of pull
parsing. I thought others might find it handy.

Best,
Riyad

On Mar 10, 4:35 pm, Joseph Earl <[email protected]> wrote:
> What's this like in terms of speed/memory compared to say a
> SaxParser ?
>
> On Mar 10, 10:02 pm, Riyad <[email protected]> wrote:
>
>
>
>
>
>
>
> > Simple Java XML Parser (SJXP) 2.0 is released.
>
> > SJXP is a very light weight (4 class) abstraction to XML Pull Parsing
> > on Android (and Java in general) that allows you to use XPath-like
> > expressions in parsing without needing to worry about while loops,
> > event handling, try-catch blocks, etc.
>
> > A quick example of parsing story links from an RSS feed would look
> > like this:
> > =================
> > IRule linkRule = new DefaultRule(Type.CHARACTER, "/rss/channel/item/
> > link") {
> >         @Override
> >         public void handleParsedCharacters(XMLParser parser, String
> > text, Object userObject) {
> >                 // Also store the link, or something equivalently
> > fancy
> >         }
>
> > }
>
> > XMLParser parser = new XMLParser(linkRule);
> > parser.parse(xmlInputStream);
> > =================
>
> > You just specify a type for the rule, provide a path in the XML you
> > want parsed and then override 1 of 3 default no-op handlers and then
> > you can just sit around waiting for data to show up at your doorstep.
> > Namespaces are also supported, please see the project page for a lot
> > more documentation, examples and benchmarks.
>
> > Performance + Ease of Use is the big win and the design focus of SJXP.
>
> > New and Noteworthy
> > ===============
> > * Memory usage and CPU usage are a magnitude times smaller than what
> > they were in 1.x series. Spent some quality time with HPROF finding
> > and removing hotspots.
> > * A new TAG type of rule is supported if you are just analyzing XML
> > metrics and don't want the overhead of parsing data out of it.
> > * Support for user-object passthrough was added to make it easier to
> > get at data stores inside of the handlers.
>
> > Project:http://www.thebuzzmedia.com/software/simple-java-xml-parser-sjxp/
> > Download:https://github.com/downloads/thebuzzmedia/simple-java-xml-parser/sjxp...
>
> > SJXP is licensed under the Apache 2 license.
>
> > Good or bad feedback is appreciated!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to