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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:38:52+00:00 2026-05-17T23:38:52+00:00

I cannot make TagSoup work. I’m using the code that follows, but when I

  • 0

I cannot make TagSoup work. I’m using the code that follows, but when I print the Node returned by the parser (the line with System.err.println(doc);) , I always get “[#document: null]”.

I don’t know how to find the bug in this code or, whichever it is, the origin of the problem. Please help!

public final Document parseDOM(final File fileToParse) {
  Parser p = new Parser();
  SAX2DOM sax2dom = null;
  org.w3c.dom.Node doc  = null;

  try { 

        URL url = new URL("http://stackoverflow.com/");
        p.setFeature(Parser.namespacesFeature, false);
        p.setFeature(Parser.namespacePrefixesFeature, false);
        sax2dom = new SAX2DOM();
        p.setContentHandler(sax2dom);
        p.parse(new InputSource(new InputStreamReader(url.openStream())));
        doc = sax2dom.getDOM();
        System.err.println(doc);
  } catch (Exception e) {
     // TODO handle exception
     e.printStackTrace();
  }


  return doc.getOwnerDocument();
 }
  • 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-17T23:38:52+00:00Added an answer on May 17, 2026 at 11:38 pm

    From the documentation on getOwnerDocument:

    When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

    Since getDOM in your case should return a Document, you could simply cast the return value or change the type of doc to Document.

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

Sidebar

Related Questions

I am trying to get the access key but I cannot make it work.
I'm trying to set up log4net but I cannot make it work. I've put
I am storing objects in a buffer. Now I know that I cannot make
We're testing WYSIWYG editors, and we cannot see to make them work with asynchronous
At this moment I cannot make changes to the code behind for a few
I am working on an ASP.NET project and I cannot make the breakpoints work!
I cannot figure out how to make a C# Windows Form application write to
I need to make an ArrayList of ArrayLists thread safe. I also cannot have
I cannot get a two-way bind in WPF to work. I have a string
I cannot make my Perl script run stable on the server. Here is the

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.