|Problems? Is your data what you think it is?|
Concatenating XML filesby moritz (Cardinal)
|on Jul 30, 2007 at 14:20 UTC||Need Help??|
moritz has asked for the
wisdom of the Perl Monks concerning the following question:
Dear Monks, I have to concatenate xml files, and discard the outer delimiting tags.
So the files might look like this:
My first attempt was to use XML::Twig, but the vast number of methods overwhelmed me, and I couldn't find one that simply returns a text representation of all the sub elements (including markup).
Is there an easy way to do it with XML::Twig or another XML module?
I could certainly use regexes to parse the beginning of the file and then paste it verbatim until the second-to-last line in the file, but that seems a bit ugly, so I'd appreciate better suggestions ;-)
Update: fixed type in title (how embarrassing)