I have XML that contains ' for ', etc. When I parse it in using XML::Twig and then print it out again, all the ' are printed as '. Also, XML::Twig seems to reorder attributes to put them in alphabetical order. From the point of view of XML, these are equivalent, but, I want to make a small set of changes to XML and use diff to confirm the only changes made are the ones I intended. Is there a way to get XML::Twig to change nothing except what I explicitly change?
Here's my XML:
<?xml version="1.0" encoding="utf-8"?>
<System>
<P C="C" B="B" A="A">'<>"&</P>
<P A="A" B="B" C="C">'<>"&</P>
</System>
And the perl:
my $twig = new XML::Twig(KeepSpaces => 'true');
$twig->parsefile("test.xml");
$twig->print();
And here's what gets printed:
<?xml version="1.0" encoding="utf-8"?>
<System>
<P A="A" B="B" C="C">'<>"&</P>
<P A="A" B="B" C="C">'<>"&</P>
</System>