/** {@inheritDoc} */ protected void finalize() throws Throwable { super.finalize(); owningPool.returnBuilder(this); } }
try { log.trace("Parsing retrieved metadata into a DOM object"); Document mdDocument = parser.parse(metadataInput);
/** {@inheritDoc} */ public Element marshall(XMLObject xmlObject) throws MarshallingException { try { Document document = Configuration.getParserPool().newDocument(); return marshall(xmlObject, document); } catch (XMLParserException e) { throw new MarshallingException("Unable to create Document to place marshalled elements in", e); } }
/** * Parse the specified input stream in a DOM DocumentFragment, owned by the specified Document. * * @param input the InputStream to parse * @param owningDocument the Document which will own the returned DocumentFragment * @return a DocumentFragment * @throws DecryptionException thrown if there is an error parsing the input stream */ private DocumentFragment parseInputStream(InputStream input, Document owningDocument) throws DecryptionException { // Since Xerces currently seems not to handle parsing into a DocumentFragment // without a bit hackery, use this to simulate, so we can keep the API // the way it hopefully will look in the future. Obviously this only works for // input streams containing valid XML instances, not fragments. Document newDocument = null; try { newDocument = parserPool.parse(input); } catch (XMLParserException e) { log.error("Error parsing decrypted input stream", e); throw new DecryptionException("Error parsing input stream", e); } Element element = newDocument.getDocumentElement(); owningDocument.adoptNode(element); DocumentFragment container = owningDocument.createDocumentFragment(); container.appendChild(element); return container; }
/** {@inheritDoc} */ public Element marshall(XMLObject xmlObject) throws MarshallingException { try { Document document = Configuration.getParserPool().newDocument(); return marshall(xmlObject, document); } catch (XMLParserException e) { throw new MarshallingException("Unable to create Document to place marshalled elements in", e); } }
/** * Parse the specified input stream in a DOM DocumentFragment, owned by the specified Document. * * @param input the InputStream to parse * @param owningDocument the Document which will own the returned DocumentFragment * @return a DocumentFragment * @throws DecryptionException thrown if there is an error parsing the input stream */ private DocumentFragment parseInputStream(InputStream input, Document owningDocument) throws DecryptionException { // Since Xerces currently seems not to handle parsing into a DocumentFragment // without a bit hackery, use this to simulate, so we can keep the API // the way it hopefully will look in the future. Obviously this only works for // input streams containing valid XML instances, not fragments. Document newDocument = null; try { newDocument = parserPool.parse(input); } catch (XMLParserException e) { log.error("Error parsing decrypted input stream", e); throw new DecryptionException("Error parsing input stream", e); } Element element = newDocument.getDocumentElement(); owningDocument.adoptNode(element); DocumentFragment container = owningDocument.createDocumentFragment(); container.appendChild(element); return container; }
Document newDoc = null; try { newDoc = parserPool.newDocument(); } catch (XMLParserException e) { log.error("There was an error creating a new DOM Document", e);
/** {@inheritDoc} */ protected void finalize() throws Throwable { super.finalize(); owningPool.returnBuilder(this); } }
log.debug("Parsing InputStream into DOM document"); Document messageDoc = parserPool.parse(inputStream); Element messageElem = messageDoc.getDocumentElement();
Document newDoc = null; try { newDoc = parserPool.newDocument(); } catch (XMLParserException e) { log.error("There was an error creating a new DOM Document", e);
/** {@inheritDoc} */ protected void finalize() throws Throwable { super.finalize(); owningPool.returnBuilder(this); } }
Document messageDoc = parserPool.parse(reader); Element messageElem = messageDoc.getDocumentElement();
Document newDocument = Configuration.getParserPool().newDocument();
/** {@inheritDoc} */ protected void finalize() throws Throwable { super.finalize(); owningPool.returnBuilder(this); } }
log.debug("Parsing InputStream into DOM document"); Document messageDoc = parserPool.parse(inputStream); Element messageElem = messageDoc.getDocumentElement();
Document newDocument = Configuration.getParserPool().newDocument();
Document messageDoc = parserPool.parse(reader); Element messageElem = messageDoc.getDocumentElement();
/** * Unmarshalls the incoming response from a POST request. * * @param responseStream input stream bearing the response * * @return the response * * @throws SOAPClientException thrown if the incoming response can not be unmarshalled into an {@link Envelope} */ protected Envelope unmarshallResponse(InputStream responseStream) throws SOAPClientException { try { Element responseElem = parserPool.parse(responseStream).getDocumentElement(); if (log.isDebugEnabled()) { log.debug("Inbound SOAP message was:\n" + XMLHelper.prettyPrintXML(responseElem)); } Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(responseElem); return (Envelope) unmarshaller.unmarshall(responseElem); } catch (XMLParserException e) { throw new SOAPClientException("Unable to parse the XML within the response", e); } catch (UnmarshallingException e) { throw new SOAPClientException("unable to unmarshall the response DOM", e); } }
Document messageDoc = getPool().parse(messageStream); Element messageElem = messageDoc.getDocumentElement();
Document messageDoc = parserPool.parse(messageStream); Element messageElem = messageDoc.getDocumentElement();