-3

Possible Duplicate:
xml parsing in android

i have to parse the below give file in xml format -

The url for above file is http://simplyappointments.com/businessinfoxml.php?email=sujit_jitu06@rediffmail.com

Can anybody help me in this.... I will be very thankful to you.

Community
  • 1
  • 1
Tushar
  • 5,907
  • 15
  • 49
  • 81

1 Answers1

0

You can just use the normal Java DOM stuff.

For instance to retrieve the value of the Transaction attribute from the given link:

DocumentBuilder builder = DocumentBuilderFactory.newInstance()
                                   .newDocumentBuilder();
String urlStr = "http://simplyappointments.com/businessinfoxml.php"+
                   "?email=sujit_jitu06@rediffmail.com";

InputStream inputStream = new URL(urlStr).openStream();
InputSource inputSource = new InputSource(inputStream);
Document doc = builder.parse(inputSource);
Element element = (Element) doc.getElementsByTagName("businessinfo").item(0);
return element.getAttribute("Transaction");

If you must retrieve an XML document through the network make sure you have <uses-permission android:name="android.permission.INTERNET" /> in your Android manifest.

Alex Jasmin
  • 39,094
  • 7
  • 77
  • 67