Community

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

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.

Was this article helpful?

0 out of 0 found this helpful

Comments

18 comments

  • Avatar
    Oksana Serdyuk

    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.

    0
  • Avatar
    shivani

    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

    0
  • Avatar
    Oksana Serdyuk

    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.

    0
  • Avatar
    shivani

    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.

    0
  • Avatar
    Oksana Serdyuk

    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.

    0
  • Avatar
    shivani

    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.

    0
  • Avatar
    Oksana Serdyuk

    Could you provide us with any logs from your device?

    0
  • Avatar
    shivani

    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)

    0
  • Avatar
    shivani

    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.

    0
  • Avatar
    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.

    0
  • Avatar
    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.

    0
  • Avatar
    Oksana Serdyuk

    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.

    0
  • Avatar
    shivani

    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.

    0
  • Avatar
    Oksana Serdyuk
    0
  • Avatar
    shivani

    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.

    0
  • Avatar
    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.

    0
  • Avatar
    shivani

    http://ocrsdk.com/documentation/specifications/task-statuses/

    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 ??

    0
  • Avatar
    Oksana Serdyuk

    I have answered by email to you.

    0

Please sign in to leave a comment.