Link to home
Start Free TrialLog in
Avatar of James Murphy
James MurphyFlag for Australia

asked on

How to get single value out of XML data

Hi,

I need to get a specific value out of this XML:

<summary-data>
<summary currency-code="AUD" name="enquiry-amount" type="amount">0</summary>
<summary name="age-of-file" type="months">236</summary>
<summary name="age-of-subject" type="years">38</summary>
<summary name="time-at-address" type="months">10</summary>
<summary name="time-at-employer" type="months">22</summary>
<summary name="defaults" type="count">9</summary>
<summary currency-code="AUD" name="defaults-value" type="amount">84683</summary>
<summary name="defaults-paid" type="count">0</summary>
<summary name="defaults-12" type="count">9</summary>
<summary name="defaults-12-paid" type="count">0</summary>
<summary name="defaults-12-unpaid" type="count">9</summary>
<summary name="defaults-24-paid" type="count">0</summary>
<summary name="defaults-24-unpaid" type="count">9</summary>
<summary name="defaults-36-paid" type="count">0</summary>
<summary name="defaults-36-unpaid" type="count">9</summary>
<summary name="time-since-last-default" type="months">1</summary>
<summary name="total-enquiries" type="count">24</summary>
<summary name="enquiries-1" type="count">0</summary>
<summary name="enquiries-3" type="count">0</summary>
<summary name="enquiries-6" type="count">0</summary>
<summary name="enquiries-12" type="count">7</summary>
<summary name="time-since-last-enquiry" type="months">9</summary>
<summary name="telco-and-utility-defaults" type="count">3</summary>
<summary name="telco-and-utility-defaults-12" type="count">3</summary>
<summary name="telco-and-utility-enquiries" type="count">0</summary>
<summary name="telco-and-utility-enquiries-6" type="count">0</summary>
<summary name="telco-and-utility-enquiries-12" type="count">0</summary>
<summary name="directorships" type="count">0</summary>
<summary name="judgements" type="count">1</summary>
<summary name="bankruptcies" type="count">0</summary>
<summary name="writs-and-summons" type="count">0</summary>
<summary name="external-administration-director" type="count">0</summary>
</summary-data>

Open in new window

In particular this one
<summary name="defaults" type="count">9</summary>
I wish to get the value of 9 out.

Could someone possibly show me how to do this using XPATH or simpleXML in PHP?

your help is much appreciated!
SOLUTION
Avatar of Rikin Shah
Rikin Shah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James Murphy

ASKER

Hi,

thank you very much! That did the trick.  

Your help was very much appreciated!!