Basically I have an XML response that is returned and a string, and i need to loops through the xml and store all the information in an array. here is the xml
<?xml version="1.0" encoding="UTF-8"?>
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.2sms.com/2.0/schema/0310_ResponseReportStandard.xsd" Version="1.0">
<Error>
<ErrorCode>00</ErrorCode>
<ErrorReason>OK</ErrorReason>
</Error>
<ResponseData>
<Identification>
<UserID>jonathan.pink@2sms.com</UserID>
</Identification>
<Result>2 records were returned</Result>
<Detail>
<ReportTitle>Message Summary: Today</ReportTitle>
<Record>
<Destination>447790686158</Destination>
<Status>WithNetwork</Status>
<GUID><![CDATA[2011-03-22T10:54:22.097Z]]></GUID>
<DateSubmitted>2011-03-22T10:54:22.097</DateSubmitted>
<DateToSend></DateToSend>
<DateSent>2011-03-22T10:54:22.533</DateSent>
<DateReceived></DateReceived>
<Message><![CDATA[Yet again another test]]></Message>
<ID>2011-03-22 10:54:22.250HIHIIOJTFVETW85TS</ID>
</Record>
<Record>
<Destination>447790686158</Destination>
<Status>SUCCESS</Status>
<GUID><![CDATA[2011-03-22T10:50:40.064Z]]></GUID>
<DateSubmitted>2011-03-22T10:50:40.063</DateSubmitted>
<DateToSend></DateToSend>
<DateSent>2011-03-22T10:50:42.473</DateSent>
<DateReceived>2011-03-22T10:50:54.570</DateReceived>
<Message><![CDATA[This is a test]]></Message>
<ID>2011-03-22 10:50:40.210DRUDVMCEZGETW85TS</ID>
</Record>
<ReportPage ReportID="775797" ItemsPerPage="25" Page="1" TotalItems="2" />
</Detail>
</ResponseData>
</Response>
I need those 2 <records>
and all there data to be stored in an array. so....
an records array -> array of records -> array of each records, data....
I have been sitting here trying to work this out using TBXML which is easy enough to grab a single node.... but I can't do this :(
See Question&Answers more detail:os