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


In reply to Re: XML::Twig questions by dHarry
in thread XML::Twig questions by r1_fiend

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.