code: private Document loadNonValidating(InputStream is) {
      Document document;
      StringBuffer sb = new StringBuffer();
      BufferedReader in = null;
      try {
        in = new BufferedReader(new InputStreamReader(is, "UTF8"));
        String line = null;
        while ((line = in.readLine()) != null) {
          sb.append(line + "\n");
        }
        String xmlData = sb.toString();
        xmlData = xmlData.replace("<!DOCTYPE nitf " + "SYSTEM \"http://www.nitf.org/" + "IPTC/NITF/3.3/specification/dtd/nitf-3-3.dtd\">", "");
        document = parseStringToDOM(xmlData, "UTF-8");
        return document;
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        System.out.println("Error loading inputstream.");
      } catch (FileNotFoundException e) {
        e.printStackTrace();
        System.out.println("Error loading file inputstream.");
      } catch (IOException e) {
        e.printStackTrace();
        System.out.println("Error loading file inputstream.");
      } finally {
        if (in != null)
          try {
            in.close();
          } catch (IOException e) {
            e.printStackTrace();
          }
      }
      return null;
    }
docs: Load a document without validating it. Since instructing the java.xml
  libraries to do this does not actually disable validation, this method
  disables validation by removing the doctype declaration from the XML
  document before it is parsed.
  
  @param file
  The file to parse.
  @return The parsed document or null if an error occurs.