Soap XMl Parsing in android -


i getting xml

<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <ns2:authenticateresponse xmlns:ns2="http://auth.mobility.kra.kuali.polus.com/"     xmlns:ns3="http://rice.kuali.org/kim/v2_0"> <principal> <ns3:principalid>10000000049</ns3:principalid> <ns3:principalname>shields</ns3:principalname> <ns3:entityid>10048</ns3:entityid> <ns3:active>true</ns3:active> <ns3:versionnumber>1</ns3:versionnumber> <ns3:objectid>f07352db67502cf0e040007f0100035a</ns3:objectid> </principal> </ns2:authenticateresponse> </soap:body> </soap:envelope> 

how parse kind of xml in android.

i had tried not working

xmlparser parser = new xmlparser();     document doc = parser.getdomelement(xml); // getting dom element      nodelist nl = doc.getelementsbytagname("soap:body");      // looping through item nodes <item>     (int = 0; < nl.getlength(); i++)      {      } 

try this..

inputstream stream = new bytearrayinputstream(xmlstring.getbytes("utf-8")); documentbuilderfactory dbf = documentbuilderfactory.newinstance(); documentbuilder db = dbf.newdocumentbuilder(); document doc = db.parse(stream);  doc.getdocumentelement().normalize();  nodelist nodelist = doc.getelementsbytagname("principal");  (int = 0; < nodelist.getlength(); i++) {      node node = nodelist.item(i);             element fstelmnt = (element) node;     nodelist namelist = fstelmnt.getelementsbytagname("ns3:principalid");     element nameelement = (element) namelist.item(0);     namelist = nameelement.getchildnodes();      system.out.println("ns3:principalid : "+(((node) namelist.item(0)).getnodevalue())); } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -