RE: PerlSax to parse/search large (~350 MB) file
by Matt Sergeant other posts by this author
Jul 11 2001 1:26PM messages near this date
view in the new Beta List Site
RE: PerlSax to parse/search large (~350 MB) file
|
RE: PerlSax to parse/search large (~350 MB) file
On Wed, 11 Jul 2001, Corey Smith (s) wrote:
> Let me try this again. Here's a sample line from the xml file I'm working
> with:
>
> <conDef><name>Influenza</name><code>C12345</code><id>637</id>..............<
> /condDef>
>
> I would like to search the file for the content of the <code> tag. Once the
> code is located, the entire line (everything from <conDef> to </conDef>)
> containing that code will be output. Because the file is large,
> speed/efficiency is important.
>
> Thanks for the response.
You need to do your own state management. Save the conDef, name, and so on
each time you see it (store it in your handler object somehow - the
implementation of that is up to you). Then when you get a match, you can
output everything you've seen so far, set a flag to say you've found the
match, and output everything else. Then un-set the "match" flag in the
end_element callback for </conDef> .
--
<Matt/>
/|| ** Founder and CTO ** ** http://axkit.com/ **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** mod_perl news and resources: http://take23.org **
\\//
//\ // \
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
http://listserv.ActiveState.com/mailman/listinfo/perl-xml
Thread:
Corey Smith (s)
Matt Sergeant
|