public Document doc ( ) throws IOException { // if the stream has already been read, use the text format InputSource is ; if ( document == null ) { if ( text == null ) { is = new InputSource ( inputStream ) ; is . setEncoding ( getCharSet ( ) . name ( ) ) ; } else { is = new InputSource ( new StringReader ( text ) ) ; } try { document = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . parse ( is ) ; } catch ( SAXException e ) { e . printStackTrace ( ) ; } catch ( ParserConfigurationException e ) { e . printStackTrace ( ) ; } inputStream . close ( ) ; } return document ; }
Return the DOM of the XML resource .