1

I am trying to parse an XML file which i get from a URL.

When parsing the XML from a local file from the Assets folder, there is no problem:

InputStream is = getAssets().open("xml-test.xml");  
Document dom = db.parse(is);

This works fine But when i try to get the data from the web:

InputStream in = httpConnection.getInputStream();  
Document dom = db.parse(in);

i get the SAX exception.

specifically: "Unexpected Token (Position:TEXT {"Quotes": [{"Quo...@1:678 in java:io:InputStreamReader@41772e00)

the local file contains the same data as coming from the URL:

This is the URL:

http://partners.api.skyscanner.net/apiservices/browsequotes/v1.0/GB/GBP/en-GB/UK/anywhere/anytime/anytime?apiKey=prtl6749387986743898559646983194

Why is there a SAXException?

Thanks!

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
  • see this http://stackoverflow.com/a/10501540/1944666 – kirankk Aug 24 '13 at 17:27
  • but the xml i have is valid, as you can see in the link i provided. Also, when i "view source" and save to xml file, it works. so i dont think that the xml provided by the website is not valid. – user2713910 Aug 24 '13 at 19:23

0 Answers0