I've written two scripts with XML::Simple and XML::DOM to do some replacements they work but with XML::Simple I have a problem with the output being alphabetically sorted which I've read is a limitation. I'm now trying to do the same with XML::Twig but can't seem to figure out how to do it. I've displayed the XML and the Simple code so you can get a better understanding of what I want to achieve. I'm wanting to change the Id= part from Id="/Local/
App/App1" to Id=/App1"
XML snip:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Profile xmlns="xxxxxxxxx" name="" version="1.1" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance">
<Application Name="App1" Id="/Local/App/App1" Services="1" pol
+icy=""
StartApp="" Bal="5" sessInt="500" WaterMark="1.0"/>
<AppProfileGuid>586e3456dt</AppProfileGuid>
</Profile>
XML Simple Code
use XML::Simple;
my $xml = new XML::Simple (ForceArray => 1, KeepRoot => 1,KeyAttr=>[])
+;
my $data = $xml->XMLin($xmlfile);
my $Id = $data->{Profile}->[0]->{Application}->[0]->{Id};
my $CsID = (split(/\//, $Id))[-1];
$data->{Profile}->[0]->{Application}->[0]->{Id} = $CsID;
print $xml->XMLout($data);