XML : Simplest Nested XML Parsing in AIX

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 xmlns:ns2="com.isap.deployment.bean.DeploymentBean">      <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.

Please help to create the simplest perl or shell script for this.

No comments:

Post a Comment