private static DocumentType getDocType ( final InputStream body ) throws IOException { final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; try { factory . setFeature ( RsPrettyXml . LOAD_EXTERNAL_DTD , false ) ; final DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( body ) . getDoctype ( ) ; } catch ( final ParserConfigurationException | SAXException ex ) { throw new IOException ( ex ) ; } }
Parses the input stream and returns DocumentType built without loading any external DTD schemas .