[R] SAX Parser best practise

Jan Hummel Hummel at mpimp-golm.mpg.de
Wed Sep 21 08:43:41 CEST 2005

Dear All,

I have a question regarding best practise in setting up a XML parser
within R. 
Because I have files with more than 100 MB and I'm only interested in
some values I think a SAX-like parser using xmlEventParse() will be the
best solution.
Unfortunately the values I'm looking for, to construct some higher "mass
spectrum", are distributed over different lines: as <spectrum id="2">,
<mzArrayBinary>, <intenArrayBinary> <... name="MassToChargeRatio"
value="445.598999"/> (as one can see in the xml snip set)

I know the mechanism of using Event Handlers, as shown in the examples.
But what I'm looking for is, how can I use some "path information" as
mentioned in "addContext" parameter of xmlEventParse()? May somebody
share a example using "addContext = TRUE" and pointing me to the
variables I may use if I implement the "..." parameter within my

Do I have to implement a "status machine" using some variables within my
handlers, or would one prefer to use the "state" parameter of

I would appreciate any assistance very much!

More information about the R-help mailing list