@Override public void write(OutputStream out) throws IOException { try { TransformerFactory.newInstance().newTransformer().transform( new SAXSource(makeReader(true), content), new StreamResult(new OutputStreamWriter(out, "UTF-8")) ); } catch (TransformerException e) { logger.error("Failed to transform input source into result",e); throw new MarkLogicIOException(e); } }
@Override public void write(OutputStream out) throws IOException { try { TransformerFactory.newInstance().newTransformer().transform( new SAXSource(makeReader(true), content), new StreamResult(new OutputStreamWriter(out, "UTF-8")) ); } catch (TransformerException e) { logger.error("Failed to transform input source into result",e); throw new MarkLogicIOException(e); } }
/** * Reads the input source, sending SAX events to the supplied content handler. * @param handler the SAX content handler */ public void process(ContentHandler handler) { try { if (logger.isInfoEnabled()) logger.info("Processing input source with SAX content handler"); XMLReader reader = makeReader(false); reader.setContentHandler(handler); reader.parse(content); } catch (SAXException e) { logger.error("Failed to process input source with SAX content handler",e); throw new MarkLogicInternalException(e); } catch (IOException e) { logger.error("Failed to process input source with SAX content handler",e); throw new MarkLogicInternalException(e); } }
/** * Reads the input source, sending SAX events to the supplied content handler. * @param handler the SAX content handler */ public void process(ContentHandler handler) { try { if (logger.isInfoEnabled()) logger.info("Processing input source with SAX content handler"); XMLReader reader = makeReader(false); reader.setContentHandler(handler); reader.parse(content); } catch (SAXException e) { logger.error("Failed to process input source with SAX content handler",e); throw new MarkLogicInternalException(e); } catch (IOException e) { logger.error("Failed to process input source with SAX content handler",e); throw new MarkLogicInternalException(e); } }