I have a SOAP web service that returns an XML in this format
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:GetResponse>
<ret SOAP-ENC:arrayType="ns2:Map[2]" xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">ProtocolId</key>
<value xsi:type="xsd:string">1</value>
</item>
<item>
<key xsi:type="xsd:string">Title</key>
<value xsi:type="xsd:string">Some Title</value>
</item>
<item>
<key xsi:type="xsd:string">Text</key>
<value xsi:type="xsd:string"> Some Text </value>
</item>
</item>
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">ProtocolId</key>
<value xsi:type="xsd:string">2</value>
</item>
<item>
<key xsi:type="xsd:string">Title</key>
<value xsi:type="xsd:string">Another Title</value>
</item>
<item>
<key xsi:type="xsd:string">Text</key>
<value xsi:type="xsd:string">Another Text </value>
</item>
</item>
</ret>
</ns1:GetResponse>
</SOAP-ENV:Body>
How to write a parser for this kind of XML. If you have some examples, it will be of great help.
Thanks
Mukul
I made it work with this parser –
The Stringbuilder i have used to create a string out of the values returned by the XML and use this string directly to write to the database. The parse method takes an inputstream, the application context and a string that helps me build the sql statement. From the parser itself i write directly to the database. Since the XML was very large (7MB), i had to do it this way otherwise my android device would run out of memory while building 1500+ objects.