XP is just a number | |
PerlMonks |
Replacing things in XML filesby John M. Dlugosz (Monsignor) |
on Apr 26, 2006 at 19:10 UTC ( [id://545849]=perlquestion: print w/replies, xml ) | Need Help?? |
John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
In general, suppose I wanted to find and replace some things in an XML file. I could make a lot of assumptions about the formatting and context, and do ordinary pattern replacements, and print out each line possibly with changes. But it would be far better to actually parse the XML correctly, look up the item in the document model, change it, and then re-save the file. So, what about the original formatting of the file? I want to keep the comments, indents and line breaks from the original, making a minimal change. What's the normal idiom for that? —John
Back to
Seekers of Perl Wisdom
|
|