go ahead... be a heretic | |
PerlMonks |
XML stream processingby dug (Chaplain) |
on Nov 15, 2002 at 05:47 UTC ( [id://213078]=perlquestion: print w/replies, xml ) | Need Help?? |
dug has asked for the wisdom of the Perl Monks concerning the following question:
Hello, fellow monastics.
I've recently been working with XML::SAX::Machines (specifically XML::SAX::ByRecord), setting up a stream parser for large collections of XML documents. Essentially, the stream looks like:
I need to be able to grab everything between (and including) <Doc> and </Doc> as it comes through the stream, and treat it like its own "Document". All of the examples for XML::SAX::ByRecord that I've looked at showed how to write *filters* that process as I've described. None that I have seen (probably a problem with my eyesight, not the documentation) have explained how to work with each of these "Documents" in the stream as its own isolated chunk of content so that one can process it independently of the filter. Below is my the code that I've come up with to handle the task that I've explained above. I can't help thinking that it's a bit of a kludge. What is a more elegant way to deal with this type of stream processing? Thanks in advance, dug
Back to
Seekers of Perl Wisdom
|
|