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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:07:08+00:00 2026-05-30T08:07:08+00:00

Yesterday Oracle decided to take down java.sun.com for a while. This screwed things up

  • 0

Yesterday Oracle decided to take down java.sun.com for a while. This screwed things up for me because xalan tried to validate some XML but couldn’t retrieve the properties.dtd.

I’m using xalan 2.7.1 to run some XSL transforms, and I don’t want it to validate anything.
so tried loading up the XSL like this:

SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(false);
XMLReader rdr = spf.newSAXParser().getXMLReader();      
Source xsl = new SAXSource(rdr, new InputSource(xslFilePath));  
Templates cachedXSLT  = factory.newTemplates(xsl);
Transformer transformer = cachedXSLT.newTransformer();         
transformer.transform(xmlSource, result);  

in the XSL itself, I do something like this:

  <xsl:variable name="entry" select="document(concat($prefix, $locale_part, $suffix))/properties/entry[@key=$key]"/>

The XML this code retrieves has the following definition at the top:

<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="...

Despite the java code above instructing the parser to NOT VALIDATE, it still sends a request to java.sun.com. While java.sun.com is unavailable, this makes the transform fail with the message:

 Can not load requested doc: http://java.sun.com/dtd/properties.dtd

How do I get xalan to stop trying to validate the XML loaded from the “document” function?

  • 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-30T08:07:10+00:00Added an answer on May 30, 2026 at 8:07 am

    The documentation mentions that the parser may read the DTDs even if not validating, as it may become necessary to use the DTD to resolve (expand) entities.

    Since I don’t have control over the XML documents, nont’s option of modifying the XML was not available to me.

    I managed to shut down attempts to pull in DTD documents by sabotaging the resolver, as follows.

    My code uses a DocumentBuilder to return a Document (= DOM) but the XMLReader as per the OP’s example also has a method setEntityResolver so the same technique should work with that.

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(false); // turns off validation
    factory.setSchema(null);      // turns off use of schema
                                  // but that's *still* not enough!
    builder = factory.newDocumentBuilder();
    builder.setEntityResolver(new NullEntityResolver()); // swap in a dummy resolver
    return builder().parse(xmlFile); 
    

    Here, now, is my fake resolver: It returns an empty InputStream no matter what’s asked of it.

    /** my resolver that doesn't */
    private static class NullEntityResolver implements EntityResolver {
    
        public InputSource resolveEntity(String publicId, String systemId) 
        throws SAXException, IOException {
            // Message only for debugging / if you care
            System.out.println("I'm asked to resolve: " + publicId + " / " + systemId);
            return new InputSource(new ByteArrayInputStream(new byte[0]));
        }
    
    }
    

    Alternatively, your fake resolver could return streams of actual documents read as local resources or whatever.

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

Sidebar

Related Questions

Yesterday i tried to use std::unordered_map and this code confused me how much memory
Yesterday I wanted to add a boolean field to an Oracle table. However, there
Yesterday, I asked this question and never really got an answer I was really
Yesterday, I discovered the Subversion (SVN) blame feature, and I was wondering, is this
Yesterday, I found myself writing code like this: SomeStruct getSomeStruct() { SomeStruct input; cin
Yesterday I found this function: function clone(obj) { return typeof obj === 'undefined' ?
Yesterday my friend -BI Specialist - explained me an oracle problem : there's an
Yesterday evening I left the office with a running Java program written by me.
Yesterday I read some code of a colleague and came across this: class a_class
Yesterday my HDD decided to die on me, which caused me to lose 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.