If you look at how the SAX parser works, it takes the "document"
and steps through it like an array.   You can write a "handler", which
is a single class in about 20 lines of code.   I tried the JDOM for some
of my documents, but I had to keep working down the tree, checking for
null, etc.   With the search results, you are only interested in a couple of
tags, all it takes is a couple of ifs.  The nice part is you don't have to put
in any tree logic.

I have some timing checks and all of these are fast, so unless you are doing
it constantly, speed is not an issue.

HTH,

Mark

Unknown wrote:

> JN> i am StringTokenizing and parsing the xpathquery result. finally! only 
> now i
> JN> am positive that what i knew is correct :-)
>
> Nanni,  StringTokenizer  may  be  in  some  cases  slower  than  a  regular
> expression,  which  is  mostly  automaton-based  transitions between states
> (i.e.  pretty  fast  ;).  More, a regular expression pattern you can easily
> throw  out to properties or some other external configuration, while string
> tokenizing  will embed the logic of extracting that information you need in
> the code.
>
> You know what fits your needs best of course.
>
> Cheers,
> Dawid

Reply via email to