How can I parse file containing xml ?
I am sure that its best to use perl - but my perl is not very good - can someone help?
Example below contents of file containing the xml - I basically want to parse the file and have each field contained in a variable..
ie. I want to store the account number in a variable, name in a variable, add in a variable
So I could just echo $accountnumb $name $add etc and get the following
65004 Bob Daly Ireland
XML Sample File
<?xml version="1.0"?>
<po:Message
xmlns
o="http://192.168.50.167/cust/api"
xmlns="http://192.168.50.167/cust"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://192.168.50.167/cust/api http://database1.com:1008/cust/api/jsp/xsd/api_v3_xsd.jsp"
>
<po:Response>
<po:Header>
<po:RequestUrl><![CDATA[/cust/api/ACCOUNTDetail]]></po:RequestUrl>
<po:RequestCommand>ACCOUNT_DETAILS</po:RequestCommand>
<po:Version>6</po:Version>
<po:Id>000001</po:Id>
<po:Opid><![CDATA[XXX]]></po:Opid>
<po:Status>
<po:Response>SUCCESS</po:Response>
<po:Text>
<![CDATA[Service successfully completed.]]>
</po:Text>
<po:StatusKey><![CDATA[SERVICE_SUCCESS]]></po:StatusKey>
<po:StatusParams cACCOUNT="0">
</po:StatusParams>
</po:Status>
</po:Header>
<po:Body>
<po:RequestKey>
<po:RequestCust>65004</po:RequestCust>
</po:RequestKey>
<ACCOUNT>
<ACCOUNT>65004</ACCOUNT>
<MasterACCOUNT>65004</MasterACCOUNT>
<SubscriberType>SUBS_TYPE_STANDALONE</SubscriberType>
<Name>Bob Daly</Name>
<Add>Ireland</Add>
<ClassDescs>
<ClassDesc><![CDATA[Social Account]]></ClassDesc>
<TempClassDesc><![CDATA[]]></TempClassDesc>
</ClassDescs>
<ClassChangedDateTime></ClassChangedDateTime>
<PreferredLanguage><![CDATA[EN]]></PreferredLanguage>
<PreferredCurrency><![CDATA[EUR]]></PreferredCurrency>
<CurrentPromotionPlan><![CDATA[]]></CurrentPromotionPlan>
<SubscriptionStatus>ACTIVE</SubscriptionStatus>
<TempStatus>NOT_BLOCKED</TempStatus>
<EocnSelStructId>255</EocnSelStructId>
<Agent><![CDATA[00000000]]></Agent>
<SubAgent><![CDATA[]]></SubAgent>
<DisconnectReason><![CDATA[]]></DisconnectReason>
<DisconReasonText><![CDATA[]]></DisconReasonText>
<BeginDate>16-Jul-2008</BeginDate>
<StartDate>16-Jul-2008</StartDate>
<ServiceRemovalDate>12-Sep-2009</ServiceRemovalDate>
<LastModification>12-Sep-2008 13:24:33</LastModification>
</ACCOUNT>
</po:Body>
</po:Response>
</po:Message>