/** * Constructor for an empty document. * * @param mediaType * The representation's media type. */ public DomRepresentation(MediaType mediaType) throws IOException { super(mediaType); this.document = getDocumentBuilder().newDocument(); }
/** * Constructor for an empty document. * * @param mediaType * The representation's media type. */ public DomRepresentation(MediaType mediaType) throws IOException { super(mediaType); this.document = getDocumentBuilder().newDocument(); }
/** * Constructor for an empty document. * * @param mediaType * The representation's media type. */ public DomRepresentation(MediaType mediaType) throws IOException { super(mediaType); this.dom = getDocumentBuilder().newDocument(); }
/** * 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. */ public Document getDocument() throws IOException { if (this.dom == null) { if (this.xmlRepresentation != null) { try { this.dom = getDocumentBuilder().parse( this.xmlRepresentation.getStream()); } catch (SAXException se) { throw new IOException( "Couldn't read the XML representation. " + se.getMessage()); } } else { this.dom = getDocumentBuilder().newDocument(); } } return this.dom; }
/** * 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; }