in reply to compacting XML?

The "kitchen sink" module for manipulating XML is XML::Twig. Consider:

use strict; use warnings; use XML::Twig; my $xml = <<XML; <outermost> <innermost> <first>1</first> <second/> <third>These spaces are to be preserved.</third> </innermost> </outermost> XML my $twig = XML::Twig->new(); $twig->parse ($xml); $twig->print();

Prints:

<outermost><innermost><first>1</first><second/><third>These spaces are + to be preserved.</third></innermost></outermost>
True laziness is hard work