Reputation: 9551
I am having the same problem to the one quoted here on Android.
The solution given was to use a URI rather than the inputstream.
I believe that you can use an inputStream as the API indicates but obviously there is something wrong with the stream that is raising exceptions with the parse method. I can confirm all the data is going into the stream, and the SAXParseException indicates that all the data is going to the parse method as I can use getColumnNumber method which returns -1, (indicating the entire stream has been read). But it looks like the parse method is not acknowledging this as the end of the stream, thus raising the "Unexpected end of file" (?)
Can someone please advise how to use an inputstream rather than the URI as input to the parse method ?
Upvotes: 0
Views: 566
Reputation: 13477
I had this problem but the cause was that I was accepting the inputstream in the wrong encoding format. Make sure that you put it in the right encoding first (maybe by reading it in as a byte[] and using the String(byte[], String) constructor) and then try and put it through the SAX parser.
And if you want to parse XML in Android maybe you would be better off using the Simple library in Android.
Upvotes: 1