Hi

Was just about to post a response when I saw your clarification re: keszler. However, I'm still not quite sure what you mean by an editor... Do you mean you want to open the file for a human to change, or you want to change the file without reading the whole thing into memory?

You can "edit" XML as a stream using some of the XML modules already mentioned by keszler. In particular I've used XML::Twig for large files. though I wouldn't say it was exactly fast. Depends how complex the changes are (you have to output to a tempfile and rename, as far as I know).

FalseVinylShrub

N.B. Please review and test code, and use at your own risk... If I answer a question, I would like to hear if and how you solved your problem.


In reply to Re: Edit XML File in perl by FalseVinylShrub
in thread Edit XML File in perl by py_201

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.