/** * Returns the wrapped DOM document. If no document is defined yet, it * attempts to parse the XML representation eventually given at construction * time. Otherwise, it just creates a new document. * * @return The wrapped DOM document. */ @Override public Document getDocument() throws IOException { if (this.document == null) { if (this.xmlRepresentation != null) { try { this.document = getDocumentBuilder().parse(getInputSource()); } catch (SAXException se) { throw new IOException("Couldn't read the XML representation. " + se.getMessage()); } } else { this.document = getDocumentBuilder().newDocument(); } } return this.document; }
/** * Returns the wrapped DOM document. If no document is defined yet, it * attempts to parse the XML representation eventually given at construction * time. Otherwise, it just creates a new document. * * @return The wrapped DOM document. */ @Override public Document getDocument() throws IOException { if (this.document == null) { if (this.xmlRepresentation != null) { try { this.document = getDocumentBuilder() .parse(getInputSource()); } catch (SAXException se) { throw new IOException( "Couldn't read the XML representation. " + se.getMessage()); } } else { this.document = getDocumentBuilder().newDocument(); } } return this.document; }