@Override public void write(OutputStream out) throws IOException { try { if (logger.isDebugEnabled()) logger.debug("Serializing DOM document to output stream"); DocumentBuilderFactory factory = getFactory(); if (factory == null) { throw new MarkLogicInternalException("Failed to make DOM document builder factory"); } DOMImplementationLS domImpl = (DOMImplementationLS) factory.newDocumentBuilder().getDOMImplementation(); LSOutput domOutput = domImpl.createLSOutput(); domOutput.setEncoding("UTF-8"); domOutput.setByteStream(out); domImpl.createLSSerializer().write(content, domOutput); } catch (DOMException e) { logger.error("Failed to serialize DOM document to output stream",e); throw new MarkLogicInternalException(e); } catch (LSException e) { logger.error("Failed to serialize DOM document to output stream",e); throw new MarkLogicInternalException(e); } catch (ParserConfigurationException e) { logger.error("Failed to serialize DOM document to output stream",e); throw new MarkLogicInternalException(e); } } }
@Override public void write(OutputStream out) throws IOException { try { if (logger.isInfoEnabled()) logger.info("Serializing DOM document to output stream"); DocumentBuilderFactory factory = getFactory(); if (factory == null) { throw new MarkLogicInternalException("Failed to make DOM document builder factory"); } DOMImplementationLS domImpl = (DOMImplementationLS) factory.newDocumentBuilder().getDOMImplementation(); LSOutput domOutput = domImpl.createLSOutput(); domOutput.setEncoding("UTF-8"); domOutput.setByteStream(out); domImpl.createLSSerializer().write(content, domOutput); } catch (DOMException e) { logger.error("Failed to serialize DOM document to output stream",e); throw new MarkLogicInternalException(e); } catch (LSException e) { logger.error("Failed to serialize DOM document to output stream",e); throw new MarkLogicInternalException(e); } catch (ParserConfigurationException e) { logger.error("Failed to serialize DOM document to output stream",e); throw new MarkLogicInternalException(e); } } }
logger.info("Parsing DOM document from input stream"); DocumentBuilderFactory factory = getFactory(); if (factory == null) { throw new MarkLogicInternalException("Failed to make DOM document builder factory");
logger.debug("Parsing DOM document from input stream"); DocumentBuilderFactory factory = getFactory(); if (factory == null) { throw new MarkLogicInternalException("Failed to make DOM document builder factory");