Package javax.xml.transform

Examples of javax.xml.transform.Result


     * @param state   a stack on which the instruction can save state information during the call on processLeft()
     */

    public void processRight(Stack<XPathContext> contextStack, Stack state) throws XPathException {
        XPathContext context = contextStack.pop();
        Result result = (Result)state.pop();
        OutputURIResolver resolver = (OutputURIResolver)state.pop();
        SequenceReceiver out = (SequenceReceiver)state.pop();
        try {
            out.endDocument();
        } catch (XPathException err) {
View Full Code Here


 
  protected String getCurrentPageSource() {
        try {
          final DOMSource source = new DOMSource(webView.getEngine().getDocument());
            try (final StringWriter stringWriter = new StringWriter()) {
                final Result result = new StreamResult(stringWriter);
                Transformer transformer = TransformerFactory.newInstance().newTransformer();
                transformer.transform(source, result);
                return stringWriter.getBuffer().toString();
            }
        } catch (final Throwable t) {
View Full Code Here

      // we can write directly to the Result
      t.transform(source, result);
  else if (var != null) {
      // we need a Document
      Document d = db.newDocument();
      Result doc = new DOMResult(d);
      t.transform(source, doc);
      pageContext.setAttribute(var, d, scope);
  } else {
      Result page =
    new StreamResult(new SafeWriter(pageContext.getOut()));
      t.transform(source, page);
  }

  return EVAL_PAGE;
View Full Code Here

    public byte[] evaluateAsBytes(Exchange exchange) throws Exception {
        LOG.debug("evaluateAsBytes: {} for exchange: {}", expression, exchange);
        initialize(exchange);

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        Result result = new StreamResult(buffer);
        getExpression().pull(createDynamicContext(exchange), result, properties);

        byte[] answer = buffer.toByteArray();
        buffer.close();
        return answer;
View Full Code Here

                              (OutputPropertiesFactory.getDefaultMethodProperties("xml"));
      serializer.setOutputStream(fos);
  
     
      // Set the result handling to be a serialization to the file output stream.
      Result result = new SAXResult(serializer.asContentHandler());
      handler.setResult(result);
     
      // Parse the XML input document.
      reader.parse("birds.xml");
     
View Full Code Here

            return this.writer;
        }

        @Override
        public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException {
            Result result = new StreamResult(this.writer);
            result.setSystemId("id");
            return result;
        }
View Full Code Here

    {
        try
        {
            Transformer transformer = createTransformer();
            Source source = new DOMSource(createDocument());
            Result result = new StreamResult(writer);
            transformer.transform(source, result);
        }
        catch (TransformerException e)
        {
            throw new ConfigurationException(e.getMessage(), e);
View Full Code Here

            // Prepare the DOM document for writing
            Source source = new DOMSource(doc);

            // Prepare the output file
            File file = new File(filename);
            Result result = new StreamResult(file);

            // Write the DOM document to the file
            Transformer xformer = TransformerFactory.newInstance().newTransformer();
            xformer.transform(source, result);
        } catch (TransformerConfigurationException e) {
View Full Code Here

     * @param src The xsl-fo StreamSource instance
     * @param stylesheet Optional stylesheet StreamSource instance
     * @param fop
     */
    public static void transform(StreamSource src, StreamSource stylesheet, Fop fop) throws FOPException {
        Result res = new SAXResult(fop.getDefaultHandler());
        try {
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer;
            if (stylesheet == null) {
                transformer = factory.newTransformer();
View Full Code Here

        return result.getNode();
    }

    public byte[] evaluateAsBytes(E exchange) throws Exception {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        Result result = new StreamResult(buffer);
        getExpression().pull(createDynamicContext(exchange), result, properties);
        byte[] bytes = buffer.toByteArray();
        return bytes;
    }
View Full Code Here

TOP

Related Classes of javax.xml.transform.Result

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.