I need to parse quite a few rrd xports ranging in size from 100K to 100MB, there will be up to 15 forks running concurrently reading XML in from different URLs. I have been doing lots of testing with different methods and I want to try libXML::Reader, which is where my problem begins.

My first test was the libXML push parser using a LWP callback to parse_chunk. This was lightning fast, but memory intensive. Theres always the possibility of 15 forks reading 100MB worth of data...

My next test was with XML::Twig. Using twig_roots I'm able to overcome the possible memory issues, but the time to process the XML triples.

I want to try out XML::LibXML::Reader, but the libXML modules use their own internal url functions rather than LWP. The URLs require http auth and libXML just ignores the username:password part of the URL and fails.

I could try adding a loop in a LWP callback whenever $reader->read != 1, but the code would probably get ugly quickly.

my $url = 'http://'.$username.':'.$password.'@'.$host.'/rrd_updates?start='.$starttime;

Hopefully i'm just missing something. Does anyone know how to get libXML to process the full URL natively?

Thanks

In reply to XML Parsing with libXML by msalerno

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.