I am trying to create a script in Unix to Parse a nested XML. Sample below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<deployments>
<appName>apptest</appName>
<envVariable>app</envVariable>
<fileSourceFolder>/sourceTest</fileSourceFolder>
<fileBackupFolder>/testbackup</fileBackupFolder>
<requireRestart>false</requireRestart>
<restartCommandPath>bin</restartCommandPath>
<deployment-files>
<deployment-file>
<deploymentFolder>deployment-folder</deploymentFolder>
<fileName>test-file</fileName>
</deployment-file>
</deployment-files>
<restart-commands>
<restart-command>
<commandName>./appstop</commandName>
</restart-command>
<restart-command>
<commandName>./appstart</commandName>
</restart-command>
</restart-commands>
</deployments>
I need to iterate through deployment-files and restart-command elements. I read about using Perl and the installed version is 5.8.8. However I cannot use TWIG and other XML stuff in perl because of lack of libraries. I read about other stuffs too like xml_grep, xmllint , etc but those are not installed in the machine I use and I cannot manually install those or even request for it because of a lot of constraints.
I already tried using XML::Simple based on example at http://interoperating.info/courses/perl4data/node/26 but still no good.
Please advise on how to create the simplest perl or shell script for this and please provide references. I am still new in shell script and I just started to explore perl yesterday so I will appreciate all your help. Thank you.