in reply to XML::Twig questions
1. Please use <code> and <readmore> tags. Your code is interpreted as markup and has some weird stuff in it.
2. I have tried approaching this by load each full node into memory, checking the appropriate child node's text, and either printing it or purging it based on a match or not.
This seems unnecessary to me, see 4.
3. Is there a way I can combine these two scripts somehow?
I would say yes but then again it’s not really clear to me what you try to achieve. There are several ways of using XML:Twig and you seem to mix things up a little bit. What exactly are you trying to do (from a functional point of view)?
4. Is there a way to jump to a matching ID without scanning each one, even without using start_tag_handlers and comparing the ID?
You can "jump" using xpath expressions. The parser has to go through the file anyway of course but you probably don’t have to built all the Twigs in memory.
For example:... twig_handlers => { Record[@id="429000"] => \&Record });
5. Right now it takes about 10-15 minutes to scan the document each time, or 20-30 minutes doing the "full search" (but the PC freezes, so that's not even an option).
The 10-15 minutes doesn’t sound too bad to me. XML::Twig is implemented the OO way and you generate lots of method calls. I have used XML::Twig on XML files up to 700 MB and then the times go up further. If speed is really a big issue for you can try to optimize. See Speedup for an approximately 30% gain.
Maybe brother mirod can shed his light on it. He wrote the stuff and knows it inside out.
Hope this helps
|
|---|