Hi i am again facing new error.

This error appears when the response is returned in xml tag format.

org.xml.sax.SAXParseException: Unexpected end of document

The above mentioned error is created after posting the image and receiving data in the form of xml.

Do help me out.

asked 17 Dec '16, 13:51

shivani's gravatar image


Possibly you have some network issues and the XML result has not been downloaded properly. Please check this assumption.

To let us investigate the issue kindly send the following additional information:

1) your Application ID,

2) the processed image,

3) the result XML file,

4) the logs from any HTTP debugger.

(19 Dec '16, 14:16) Oksana Serdyuk ♦♦

Hi thank you so much. Really appreciate your help.

1) Application ID : VSPL_OCR_Reader [Note this application belongs to different account on the same website but not this account]

2) Image path : /mnt/sdcard/Pictures/ABBYY Cloud OCR SDK Demo App/image.jpeg

3) Result Xml : 12-19 18:11:24.689 8249-13092/apps.com.ocrscanner D/ExceptionTest: Server result: <?xml version="1.0" encoding="utf-8"?><response><task id="b5f848ee-7a4e-4f2a-87fb-f28da26c0b97" registrationtime="2016-12-19T12:41:18Z" statuschangetime="2016-12-19T12:41:19Z" status="Queued" filescount="1" credits="5" estimatedprocessingtime="5"/></response> 12-19 18:11:25.569 8249-13092/apps.com.ocrscanner D/ExceptionTest: org.xml.sax.SAXParseException: Unexpected end of document


answered 19 Dec '16, 15:44

shivani's gravatar image


I cannot download your image, please send it to CloudOCRSDK@abbyy.com. Are you should that your image is appropriate for OCR? Please review the Best Practices article.

Regarding the result, according to the database, this task is already completed, please try to download it once again. We would like to note that you can use the getTaskStatus method to find out the current status of the task and the result URL.


answered 19 Dec '16, 16:01

Oksana%20Serdyuk's gravatar image

Oksana Serdyuk ♦♦

Hey i checked the article about Best Practices and the image i create fits all the criteria.

And i have also used getTaskStatus method and that returns task status as queued.

But i am still getting the same error.

Can you please tell me where i should upload my image ?? Because i checked the link you mentioned and could not fin an option of image upload

I also checked the internet connection and its working fine since my desktop application is scanning and returning the desired output but my android application is giving me this error.

Both the applications have used the sample code from this website itself without any changes to it.


answered 20 Dec '16, 09:50

shivani's gravatar image


I have consulted with the developers and they also recommend to check the Internet connection of your device (not your computer). This error message can be connected either with poor connection, or with changing of the modes from usual to sleep state and vice versa, when the service may close the connection with the device.

Please try to use a HTTP debugger to find out the specific issue on your side.

(20 Dec '16, 20:00) Oksana Serdyuk ♦♦

Hi there was some problem with the earlier device with internet connection.

I changed the testing device and now it connects to the internet perfectly.

But i am still getting the same error.

org.xml.sax.SAXParseException: Unexpected end of document

My other net based applications are working fine on the same internet connection.

Please help.


answered 27 Dec '16, 12:24

shivani's gravatar image


Could you provide us with any logs from your device?

(27 Dec '16, 16:11) Oksana Serdyuk ♦♦

Hi the page count from my abby account for my application has also decreased.Earlier it was 40 and now its 28. Does that mean that my image is getting scanned ??

I am really clueless and stuck at this error please help.

(28 Dec '16, 08:01) shivani

Hi i just checked again by running the application.

Prior to testing the pages in my account were 28 and fields were 142. After testing the pages decreased to 27 and fields to 137.

This means my image got scanned but i couldn't receive any data.

Please tell me how i could solve this issue and receive data at android end.

(28 Dec '16, 10:00) shivani

Hi i performed line by line debugging for the sample android code i picked up from your website.

And i am getting error in the getResponse() method of client.java class while receiving the response code.

Please get back to me need help.

(28 Dec '16, 16:53) shivani

According to our database, the tasks are processed successfully on our side. Moreover from the provided data, it seems that you have received the full response from the service, but when reading a document from a stream, the parser throws the error. The issue is on your side and you need to debug your code on your device.

Also I have added some free pages for your application.

(29 Dec '16, 14:18) Oksana Serdyuk ♦♦

Hi Can you provide the dummy or sample data format that is returned from the web api. So that it will be easier for me to design an xml reader accordingly.

Thank You for your help till now.

(29 Dec '16, 14:54) shivani
showing 5 of 6 show 1 more comments

D/ExceptionTest: Input file: /storage/sdcard0/Pictures/ABBYY Cloud OCR SDK Demo App/image.jpeg Process setting: apps.com.ocrscanner.ProcessingSettings@41d64150 D/ExceptionTest: URL: http://cloud.ocrsdk.com/processImage?language=English,Arabic&exportFormat=txt&profile=textExtraction D/ExceptionTest: Reader data: java.io.BufferedReader@41be63c0 D/ExceptionTest: Server result: <?xml version="1.0" encoding="utf-8"?><response><task id="21b9420b-7609-4b8d-ae86-aa5b68e735a7" registrationtime="2016-12-28T04:15:48Z" statuschangetime="2016-12-28T04:15:48Z" status="Queued" filescount="1" credits="5" estimatedprocessingtime="5"/></response> D/ExceptionTest: org.xml.sax.SAXParseException: Unexpected end of document at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:125) at apps.com.ocrscanner.Task.<init>(Task.java:25) at apps.com.ocrscanner.Client.getResponse(Client.java:297) at apps.com.ocrscanner.Client.processImage(Client.java:66) at apps.com.ocrscanner.AsyncProcessTask.doInBackground(AsyncProcessTask.java:73) at apps.com.ocrscanner.AsyncProcessTask.doInBackground(AsyncProcessTask.java:14) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)


answered 28 Dec '16, 07:19

shivani's gravatar image


Please see the HTTP Status Codes and Response Format article.


answered 29 Dec '16, 16:20

Oksana%20Serdyuk's gravatar image

Oksana Serdyuk ♦♦

Hi i am not getting any of the http status codes that you have mentioned in that link.

Can you be kind enough and mail me the xml sample data that is returned by the web api for my particular image.

Sorry for putting you through so much trouble.

(30 Dec '16, 07:29) shivani

Hi i am getting status code 200 and the task id is queued. I am unable to understand how the xml data is returned by the web api.

Can you be kind enough to send me the sample xml data that is returned by the web api for my particular image request.

Thank you so much and sorry for the trouble.

(30 Dec '16, 09:11) shivani


According to the above link if the task status is queued then it is waiting to get processed. How long will it take to return the scanned data from the image??

How long till i receive the scanned text ??

(30 Dec '16, 09:18) shivani

I have answered by email to you.

(03 Jan, 19:31) Oksana Serdyuk ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 17 Dec '16, 13:51

Seen: 984 times

Last updated: 03 Jan, 19:31

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal