perlquestion
perladdict
Hi Dear Monks,</br>
I am very new to the XML data manipulation using Perl, some process will generate the iprocess XML, in which few values are not populated correctly, Due to this client are editing this xml manually by using the properties file. I need to automate this task by using the Perl. I don't have any prior experience for this task.Below is the detail description of task which i need to complete.</br>The input for editing the XML is properties file, in which the lines starts with M_R signifies replacement of the values for those attributes which are existed in XML and M_A are the lines for which i need to add new nodes in the XML. Below it the properties file content and the XML which i need to modify based on the properties file.</br></br>
<code>
#Below is the Properties file content
M_R_xxxx/nodes/Application = test123
M_R_params/nodes/Environment = test
M_R_Params/Debug/log = /admin/test/xxxx/yyyy/at/domain/test123-uat/application/logs/a.log
M_R_/nodes/srv/new/build/binding/machine = tesing.com
M_A_/app/ser/ada/bind/bin/host = google.com
M_R_/ap/ser/mn/bin/bin/product/ver = 1.2.3
M_R_/app/serv/SN/bind/bin/set/perl/size = 566
M_A_/appl/ser/CN/bind/bin/set/perl/Path = /xxxx/APP/app1/alter/value
M_A_/appn/ser/XT/bind/bin/set/perl/Path = /new/test/app/minor/test123
M_R_/applx/serx/NT/bind/binding/down/time = 30
M_R_/appl/serv/PT/context/test/no = 25
M_R_/appl/ser/XT/gate/clear/state = false
</code>
</br>
The XML file which i need to modify based on the above properties file is as below.</br>
<code>
<?xml version="1.0" encoding="UTF-8"?>
<list>
<entry>
<name><first>Thadeus</first><last>Wrigley</last></name>
<phone>716-505-9910</phone>
<address>
<street>105 Marsupial Court</street>
<city>Fairport</city><state>NY</state><zip>14450</zip>
</address>
</entry>
<entry>
<name><first>Jill</first><last>Baxter</last></name>
<address>
<street>818 S. Rengstorff Avenue</street>
<zip>94040</zip>
<city>Mountainview</city><state>CA</state>
</address>
<phone>217-302-5455</phone>
</entry>
<entry>
<name><last>Riccardo</last>
<first>Preston</first></name>
<address>
<street>707 Foobah Drive</street>
<city>Mudhut</city><state>OR</state><zip>32777</zip>
</address>
<phone>111-222-333</phone></entry>
<entry>
<address>
<street>10 Jiminy Lane</street>
<city>Scrapheep</city><state>PA</state><zip>99001</zip>
</address>
<name><first>Benn</first><last>Salter</last></name>
<phone>611-328-7578</phone>
</entry>
</list>
</code>
From long time i am going through the threads which are related to XML in Perl monks,based on posts in perl monks i have installed XML::Parser,XML::libXML, based on the examples in the thread i could able to parse the XML but not able to achieve the task what actually its needed to accomplish this task.</br>I have started to read the O'REILLY Perl and XML PDF book which i have downloaded from Net, but this may take time for me to gain some knowledge on this.Experts monks could you please consider this post and consider it's an humble and very kind request from me to give your valuable inputs for me to get start with this task.</br>