Hmm. XML::Simple is 1600 lines (up to the __END__ mark,
anyway). That says to me that this is a non-trivial problem in the general case. If you really are stuck
with wheel-rewriting, you need to think about what
limitations (including doing different things in your
code based solely on tag name or whitespace) you can impose on your particular format to make life easier for you. Ideally these would be documented up front. Then you can plan an algorithm and write the code.
Two other thoughts: can you email the XML/Simple.pm file
to someone to demonstrate the non-triviality here?
And: even XML::Simple will have a hard time if it really
has to match
<downdime> with
</downtime> :)