title: Getting document as null [#document: null] After parsing XML in java using DocumentBuilder
body: <p>After parsing the documengt I am getting null, even though the document contains data.
  Here is my code, I have set all validations to false.</p>
  
  <pre><code>DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
  
      domFactory.setNamespaceAware(false); // never forget this!
      domFactory.setCoalescing(false);
      domFactory.setValidating(false);
      domFactory.setFeature("http://xml.org/sax/features/namespaces", false);
      domFactory.setFeature("http://xml.org/sax/features/validation", false);
      domFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
      domFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
      domFactory.setFeature("http://apache.org/xml/features/allow-java-encodings",
                         true);
  
  
  
      DocumentBuilder builder = domFactory.newDocumentBuilder();
  
      builder.setEntityResolver(new EntityResolver() {
          public InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
                  throws SAXException, java.io.IOException {
              if (publicId.equals("--myDTDpublicID--"))
                  // this deactivates the open office DTD
                  return new InputSource(new ByteArrayInputStream("&lt;?xml version='1.0' encoding='UTF-8'?&gt;".getBytes()));
              else return null;
          }
      });
  
  
      Document doc = null;
      URL url = new URL(urlStr);
      URLConnection urlc = url.openConnection();
  
  
  
      doc = builder.parse(urlc.getInputStream());
      System.out.println("doc:" + doc.toString());
  </code></pre>
  
  <p>The response comes as :</p>
  
  <pre><code>doc:[#document: null]
  </code></pre>
  
  <p>Why?
  Am I missing some validation?</p>