working with XML on Android

HackRos

New Member
I m new to Android (porting iOS/Objective C app ) and I have to read an XML (with some nodes in JSON) file returned by a WebService the response looks like that:\[code\]<SOAP-ENV:Envelope><SOAP-ENV:Body><ns1:TPLoginResponse><TPLoginResult>[{"content": "some json content...."]</TPLoginResult></ns1:TPLoginResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>\[/code\]how can I simply get the content of TPLoginResult ?I tried :\[code\] httpTransport.call(SOAP_ACTION, envelope); Object response = envelope.getResponse(); SoapObject SoapResponse = (SoapObject)envelope.bodyIn; Log.e("Info", "response : " + SoapResponse.toString() ); // content is successfully received here String SResponse = SoapResponse.toString(); Log.e("Info", "DocumentBuilderFactory" ); // parse the XML as a W3C Document DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); builderFactory.setNamespaceAware(true); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document document = builder.parse( new InputSource(new StringReader(SResponse)) ); NodeList nList = document.getElementsByTagName("TPLoginResult"); Log.e("info","nList length : " + nList.getLength());\[/code\]but I need a 0 length nList ...I also tryed :\[code\] NodeList nList = document.getElementsByTagName("ns1:TPLoginResponse");\[/code\]but same 0 length result..Any suggestions ?
 
Back
Top