I have the following XML :
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetCustomerCentreDetailsResponse xmlns="http://tempuri.org/">
<GetCustomerCentreDetailsResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.datacontract.org/2004/07/*****">
<a:CustomerCentre>
<a:CustomerCentreName>2 aaaaa Way </a:CustomerCentreName>
<a:CustomerCentreNumber>2</a:CustomerCentreNumber>
</a:CustomerCentre>
<a:CustomerCentre>
<a:CustomerCentreName>Test Centre </a:CustomerCentreName>
<a:CustomerCentreNumber>1</a:CustomerCentreNumber>
</a:CustomerCentre>
</GetCustomerCentreDetailsResult>
</GetCustomerCentreDetailsResponse>
</s:Body>
</s:Envelope>
All I want is the two CustomerCentres. And to display them. ( and add them to a Hash or something so i can access their data.)
My attempts have been unsucessful, as I cannot ignore the rest of the xml, plus Im not sure im doing it right.
Help would be apprieciated.
Thanks
Nokogiri is your friend for this one, as it parses XML really nicely: http://nokogiri.org/
Example: