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 8215181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:41:55+00:00 2026-06-07T11:41:55+00:00

My code was working fine yesterday, but I start it up again today and

  • 0

My code was working fine yesterday, but I start it up again today and am getting the error

org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: not well-formed (invalid token)

The xml in question doesn’t have any funky characters. It is stored in a String variable called “xml”. To be fair, I wasn’t really sure how to deal with that and was just going off of some tutorials, but here was my attempt.

out = new PrintWriter(mySocket.getOutputStream(), true);
BufferedReader br = new BufferedReader(new InputStreamReader(mySocket.getInputStream(), "US-ASCII"));
InputStream is = mySocket.getInputStream();

...
String xml = the stuff that was read in with br.read();
...

SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();

DataHandler myDataHandler = new DataHandler();
xmlR.setContentHandler(myDataHandler);
xmlR.parse(new InputSource(new StringReader(xml)));
myData = myDataHandler.getData();

Where did I go wrong?

Update: The xml starts with

<?xml version="1.0" standalone="yes"?> 

so it doesn’t seem that “line 1, column 0” actually has anything wrong with it.

Update 2: I found that is.available() is returning 0…. How do I make do with the fixing?

  • 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-06-07T11:41:56+00:00Added an answer on June 7, 2026 at 11:41 am

    I’m not sure what the problem was in the end, but I changed several things and have it somewhat working. Here’s what I changed:

    I changed

    BufferedReader br = new BufferedReader(new InputStreamReader(mySocket.getInputStream(), "US-ASCII"));
    InputStream is = mySocket.getInputStream();
    

    to

    BufferedInputStream in = new BufferedInputStream(mySocket.getInputStream());
    

    And I didn’t include this in the original question (it was part of the “…”), but I got rid of the condition

    if(in.available()>0)
    

    because it was returning 0 even though read() worked just find without it. This is probably just a temporary hack though, and I’ll need to figure out why it’s returning 0 and find a legitimate fix…

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

Sidebar

Related Questions

Hy again, Yesterday was working fine and today I receive the following error when
For single output types my code is working fine but I couldn't get how
I have jquery validation code which is working fine in ff but the same
This was working fine yesterday with no changes to the code. echo date(M, strtotime(-3
I have the following code working fine, but I'm unable to add a zoom
I have this code working fine a few times in my project but was
This same code working fine with MVC 2 but not working in MVC 3
Fairly new to asp.net Mvc and jquery. Have the following code working fine, but
The following code is working fine in Android 1.5-2.2.1 but it's not in 2.3
First off my code was working fine on simulator but it does not work

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.