use strict; use warnings; my $xml = join '', <DATA>; while ($xml =~ s/(<\/?.*?>)\s+(<\/?.*?>)/$1$2/sg) {} print $xml; __DATA__ <outermost> <innermost> <first>1</first> <second/> <third>These spaces are to be preserved.</third> </innermost> </outermost>
In reply to Re: compacting XML?
by TJPride
in thread compacting XML?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |