Looking over
XML::LibXML::Reader, and having worked with
XML::LibXML recently, I see a mismatch between what you want and its design.
Reader is great for reading XML nodes incrementally but
LibXML likes dealing with complete nodes & documents; I can't think of an easy fool-proof way to make it write chunks of a partial document, which is what you'll be doing. (Another monk might yet figure it out!)
As an alternative, SAX is good for stream-processing XML. It doesn't load an entire document in memory thus is good for incremental work (and not so good for document processing where you want random access), and it's filter-centered design is meant for precisely what you're doing.
Look for XML::SAX. I only briefly looked at it for a project recently; might be helpful for you. It's a different way of thinking than LibXML for sure!
EDIT I hadn't seen XML::Twig before, the perl-ish way of handling XML, and in theory "as good as SAX"- good to learn something new! Seems good to use that if possible, and if it still segfaults try contacting the author who is always wanting more tests, see "Test Coverage" on its page.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.