in reply to Parsing and manipulating XML
Maybe using the no_blanks => 1 option when constructing your parser already is enough? This will make libxml not parse the (considered significant by XML) whitespace between nodes.
In Section
Seekers of Perl Wisdom