Click here to Skip to main content
11,411,494 members (66,582 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java Android
During the execution of a httpPOST i store the response as a String and the response i am getting is like this:

<?xml version = "1.0" encoding= "utf-8"?>
      string xmlns="http://localhost:4471/">101~Success</string>



I just want to get 101~Success after parsing so that i can get 101 by using split function but am not able to get this element in android.I was getting this in
J2ME as:


InputStream in = new ByteArrayInputStream(strResponse.getBytes("UTF-8"));
InputStreamReader is = new InputStreamReader(in);
parser = new XmlParser(is);
doc.parse( parser );

Element root = doc.getRootElement();
Element item = doc.getElement(2);
String parsedResponse = item.getText(0);

How can i do it in android using DOM Or XmlPullParser?
Posted 3-Feb-13 21:08pm
AkshiD444
Edited 3-Feb-13 21:10pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I dont have any idea about android but in dom you can you use getTextContent() method to extract the content.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 223
1 Sascha Lefévre 155
2 Sergey Alexandrovich Kryukov 149
3 ProgramFOX 90
4 Dave Kreskowiak 90
0 Sergey Alexandrovich Kryukov 8,920
1 OriginalGriff 7,128
2 Maciej Los 3,440
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web01 | 2.8.150414.5 | Last Updated 5 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100