title: How to read well formed XML in Java, but skip the schema?
body: <p>I want to read an XML file that has a schema declaration in it.</p>
  
  <p>And that's all I want to do, read it. I don't care if it's valid, but I want it to be well formed.</p>
  
  <p>The problem is that the reader is trying to read the schema file, and failing.</p>
  
  <p>I don't want it to even try.</p>
  
  <p>I've tried disabling validation, but it still insists on trying to read the schema file.</p>
  
  <p>Ideally, I'd like to do this with a stock Java 5 JDK.</p>
  
  <p>Here's what I have so far, very simple:</p>
  
  <pre><code>    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      dbf.setValidating(false);
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(file);
  </code></pre>
  
  <p>and here's the exception I am getting back:</p>
  
  <pre><code>java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
  </code></pre>
  
  <p>Yes, this HAPPENS to be an XHTML schema, but this isn't an "XHTML" issue, it's an XML issue. Just pointing that out so folks don't get distracted. And, in this case, the W3C is basically saying "don't ask for this thing, it's a silly idea", and I agree. But, again, it's a detail of the issue, not the root of it. I don't want to ask for it AT ALL.</p>