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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:25:24+00:00 2026-06-16T09:25:24+00:00

I apologize for asking the same question, but as per my research it seemed

  • 0

I apologize for asking the same question, but as per my research it seemed in different context. I know why the error is coming but I failed to eradicate it without looking and following some programming forums. My program goes as follows: I am pinging a url and opening input stream, then that stream is written into an xml file. After that I am using Xpath to extract some information that is further used for some computation. My code is as follows:

    URL u=new URL("url here");
    HttpURLConnection con=(HttpURLConnection)u.openConnection();
    InputStream is=con.getInputStream();
    BufferedInputStream br=new BufferedInputStream(is);

    File f=new File("data.xml");
    if(f.exists())f.delete();
    f.createNewFile();
    byte data[] = new byte[1024];
    int count;
    FileOutputStream fout = new FileOutputStream(f);
    while((count = br.read(data,0,1024)) != -1)
    {
            fout.write(data, 0, count);
    }
    fout.close();

    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db=dbf.newDocumentBuilder();
    Document doc=db.parse("data.xml");

    XPathFactory  factory=XPathFactory.newInstance();
    XPath xPath=factory.newXPath();
    XPathExpression expr = xPath.compile("//tr/text()");
    Object result = expr.evaluate(doc, XPathConstants.NODESET);
    NodeList nodes = (NodeList) result;
    for (int i = 0; i < nodes.getLength(); i++) {
        System.out.println(nodes.item(i).getNodeValue());
    }

when executing this code I get : White spaces are required between publicId and systemId.
Since I am directly writing to the file, where can this white space error possibly occur?

  • 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-16T09:25:25+00:00Added an answer on June 16, 2026 at 9:25 am

    It looks like your previously written XML file is invalid, this is why you get an error parsing the file. The standard XML parsing frameworks accept only well-formed valid XML.

    If you want to work with invalid, maybe unbalanced, HTML tag-soups, I recommend JSoup as it can work with invalid XML.

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

Sidebar

Related Questions

I apologize for asking such a generalized question, but it's something that can prove
This is extremely basic and I apologize for asking such a rookie question. But
I apologize for asking such a dumb question but my linux server is stuck
I apologize for asking a very vague question but here it is. I have
I apologize in advance for asking this question, I know similar questions have already
I apologize in advance for asking such a silly question, but I can't seem
I apologize in advance for asking such a stupid question, but how do I
I apologize in advance if I am asking asking question with impossible answer. But
I might be asking the wrong question here, so I apologize if the answer
My apologies for asking such a novice question but, I need help building a

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.