Package javax.xml.transform.sax

Examples of javax.xml.transform.sax.SAXResult


            if (useDom) {
                source = exchange.getIn().getBody(DOMSource.class);
                result = new DOMResult();
            } else {
                source = exchange.getIn().getBody(SAXSource.class);
                result = new SAXResult();
            }
        } catch (Exception e) {
            throw new NoXmlBodyValidationException(exchange, e);
        }
        if (source == null) {
View Full Code Here


                NodeIterator nl = XPathAPI.selectNodeIterator(doc, xpath);
                Node n;
                while ((n = nl.nextNode())!= null)
                {
                    SAXResult result = new SAXResult(this.contentHandler);
                    result.setLexicalHandler(this.lexicalHandler);
                    serializer.transform(new DOMSource(n), result);
                }
            } else {
                DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
                streamer.stream(doc);
View Full Code Here

            // the parent is the rootReader
            this.rootReader.setContentHandler(this.currentParent);;

            // Set content handler for the end of the chain : serializer
            this.currentParent.setResult(new SAXResult(this.serializerContentHandler));

        } else {
            // Build the transformer chain on the fly
            TransformerHandler newParent=logicsheet.getTransformerHandler();

            // the currentParent is the parent of the new logicsheet filter
            this.currentParent.setResult(new SAXResult(newParent));

            // reset the new parent and the contentHanlder
            this.currentParent = newParent;
            this.currentParent.setResult(new SAXResult(this.serializerContentHandler));
        }
    }
View Full Code Here

        } else {
            // Strip start/endDocument
            handler = new EmbeddedXMLPipe(super.contentHandler);
        }
       
        SAXResult result = new SAXResult(handler);
        result.setLexicalHandler(super.lexicalHandler);

        try {
            transformer.transform(source, result);
        } catch (TransformerException e) {
            getLogger().error("DOMStreamer", e);
View Full Code Here

    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    // transform xml
    Transformer xslfoTransformer = getTransformer(transformSource);
    try {
      Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, outStream);
      Result res = new SAXResult(fop.getDefaultHandler());
      xslfoTransformer.transform(source, res);
    } catch (FOPException e) {
      throw new IOException("FOPException occurred", e);
    } catch (TransformerException e) {
      throw new IOException("TransformerException occurred", e);
View Full Code Here

    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    // transform xml
    try {
      Transformer xslfoTransformer = TransformerFactory.newInstance().newTransformer(transformSource);
      Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, outStream);
      Result res = new SAXResult(fop.getDefaultHandler());
      xslfoTransformer.transform(source, res);
    } catch (FOPException e) {
      throw new IOException("FOPException occurred", e);
    } catch (TransformerException e) {
      throw new IOException("TransformerException occurred", e);
View Full Code Here

        public final ContentHandler createContentHandler() {
            try {
                TransformerHandler handler = saxtf
                        .newTransformerHandler(templates);
                handler.setResult(new SAXResult(outputHandler));
                return handler;
            } catch (TransformerConfigurationException ex) {
                throw new RuntimeException(ex.toString());
            }
        }
View Full Code Here

                    return;
                }
            }
        }
        else if (result instanceof SAXResult) {
            SAXResult saxSource = (SAXResult) result;
            callback.saxResult(saxSource.getHandler(), saxSource.getLexicalHandler());
            return;
        }
        else if (result instanceof StreamResult) {
            StreamResult streamSource = (StreamResult) result;
            if (streamSource.getOutputStream() != null) {
View Full Code Here

    DOMSource domSource = new DOMSource(document);
    handler = new AxiomHandler(result, factory);

    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    SAXResult saxResult = new SAXResult(handler);
    transformer.transform(domSource, saxResult);

    OMElement root = result.getOMDocumentElement();
    assertEquals(2, getNamespaceCount(root));
    NamespaceContext namespaceContext = root.getNamespaceContext(false);
View Full Code Here

        TraxUtils.ResultCallback mock = createMock(TraxUtils.ResultCallback.class);
        mock.saxResult(contentHandler, lexicalHandler);

        replay(mock);

        SAXResult result = new SAXResult(contentHandler);
        result.setLexicalHandler(lexicalHandler);
        TraxUtils.doWithResult(result, mock);

        verify(mock);
    }
View Full Code Here

TOP

Related Classes of javax.xml.transform.sax.SAXResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.