Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7617505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:10:00+00:00 2026-05-31T03:10:00+00:00

I have created a blank .xml file on the SD card, and now I’m

  • 0

I have created a blank .xml file on the SD card, and now I’m trying to open it for parsing.

DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document newDoc = docBuilder.parse(xmlFile);

When it reaches the parse() method I get the following logcat:

03-11 12:07:20.676: E/Exception(18774): org.xml.sax.SAXParseException: Unexpected end of document
03-11 12:07:20.676: E/Exception(18774):     at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:131)
03-11 12:07:20.676: E/Exception(18774):     at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:186)
03-11 12:07:20.676: E/Exception(18774):     at mfc.generalguixapi8.SaveData4.saveData(SaveData4.java:76)
03-11 12:07:20.676: E/Exception(18774):     at mfc.generalguixapi8.SaveData4.onCreate(SaveData4.java:40)
03-11 12:07:20.676: E/Exception(18774):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-11 12:07:20.676: E/Exception(18774):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-11 12:07:20.676: E/Exception(18774):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-11 12:07:20.676: E/Exception(18774):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-11 12:07:20.676: E/Exception(18774):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-11 12:07:20.676: E/Exception(18774):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-11 12:07:20.676: E/Exception(18774):     at android.os.Looper.loop(Looper.java:123)
03-11 12:07:20.676: E/Exception(18774):     at android.app.ActivityThread.main(ActivityThread.java:4627)
03-11 12:07:20.676: E/Exception(18774):     at java.lang.reflect.Method.invokeNative(Native Method)
03-11 12:07:20.676: E/Exception(18774):     at java.lang.reflect.Method.invoke(Method.java:521)
03-11 12:07:20.676: E/Exception(18774):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-11 12:07:20.676: E/Exception(18774):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-11 12:07:20.676: E/Exception(18774):     at dalvik.system.NativeStart.main(Native Method)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:10:01+00:00Added an answer on May 31, 2026 at 3:10 am

    The exception is thrown because a blank file isn’t considered a valid XML file by the parser. To be able to create, change and parse XML files dynamically, you need to make sure that your file is always valid. To make it valid from the start you should consider putting in just a root tag, and then add the information inside it – this way you won’t get into trouble parsing the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a C# class file by using a XSD-file as an input.
I have a .gz file that contains an XML document. Does anyone know how
Updated to be clear. Step One: I have a XML file that I want
I have a questions.xml file which has a list of questions for my quiz,
I have created a powershell module (.psm1) file that includes a few other powershell
I've created a simple xml file here: http://roberthan.host56.com/productsNew.xml which is quite simple, the root
So I have spent the past 11 hours now trying to get even the
I have an XML file that I am transforming via XSLT. I am passing
I have created a blank asp.net website consisting of a blank default.aspx page, its
Hi to all, i have written something like this in the xml file <?xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.