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

  • Home
  • SEARCH
  • 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 84089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:52:34+00:00 2026-05-10T21:52:34+00:00

I got dtd in file and I cant remove it. When i try to

  • 0

I got dtd in file and I cant remove it. When i try to parse it in Java I get ‘Caused by: java.net.SocketException: Network is unreachable: connect’, because its remote dtd. can I disable somehow dtd checking?

  • 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. 2026-05-10T21:52:34+00:00Added an answer on May 10, 2026 at 9:52 pm

    You should be able to specify your own EntityResolver, or use specific features of your parser? See here for some approaches.

    A more complete example:

    <?xml version='1.0'?> <!DOCTYPE foo PUBLIC '//FOO//' 'foo.dtd'> <foo>     <bar>Value</bar> </foo> 

    And xpath usage:

    import java.io.File; import java.io.IOException; import java.io.StringReader;  import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory;  import org.w3c.dom.Document; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException;  public class Main {      public static void main(String[] args) throws Exception {         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();         DocumentBuilder builder = factory.newDocumentBuilder();          builder.setEntityResolver(new EntityResolver() {              @Override             public InputSource resolveEntity(String publicId, String systemId)                     throws SAXException, IOException {                 System.out.println('Ignoring ' + publicId + ', ' + systemId);                 return new InputSource(new StringReader(''));             }         });         Document document = builder.parse(new File('src/foo.xml'));         XPathFactory xpathFactory = XPathFactory.newInstance();         XPath xpath = xpathFactory.newXPath();         String content = xpath.evaluate('/foo/bar/text()', document                 .getDocumentElement());         System.out.println(content);     } } 

    Hope this helps…

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

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Here is where I found the answer.; I have reposted… May 11, 2026 at 11:02 am
  • added an answer You can call GetACP to find the current ANSI codepage,… May 11, 2026 at 11:02 am
  • added an answer For the folder name and drive, you can use: echo… May 11, 2026 at 11:01 am

Related Questions

I got dtd in file and I cant remove it. When i try to
I got into a mini-argument with my boss recently regarding project failure. After three
I got a webserver with a running application. There's a webpage with a form:
I got this error today when trying to open a Visual Studio 2008 project
I got this output when running sudo cpan Scalar::Util::Numeric jmm@freekbox:~/bfwsandbox/sa/angel/astroportal/dtu8e/resources$ sudo cpan Scalar::Util::Numeric [sudo]
I got a little curious after reading this /. article over hijacking HTTPS cookies.
I got a call from a tester about a machine that was failing our
I got this síngleton cache object and it exposes an IEnumerable property which just
I got this flash application where you can click a link while watching a
I got a comment to my answer on this thread: Malloc inside a function

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.