Package javax.xml.transform

Examples of javax.xml.transform.Result


        //Setup FOP
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);

        //Make sure the XSL transformation's result is piped through to FOP
        Result res = new SAXResult(fop.getDefaultHandler());

        //Start the transformation and rendering process
        transformer.transform(src, res);

        //Return the result
View Full Code Here


    public byte[] evaluateAsBytes(Exchange exchange) throws Exception {
        initialize();

        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

                              (OutputProperties.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

    public static String convertToXml(final String json, final JsonXmlReader reader) throws Exception {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        InputSource source = new InputSource(new StringReader(json));
        Result result = new StreamResult(out);
        transformer.transform(new SAXSource(reader, source), result);
        return new String(out.toByteArray());
    }
View Full Code Here

      // Result was supplied, the filename is relative to the source document.
      // When transforming with a SAXResult or DOMResult, call
      // TransformerImpl.setOutputTarget() to set the desired Result base.
  //      String base = urlToFileName(elem.getStylesheet().getSystemId());

      Result outputTarget = transformer.getOutputTarget();
      if ( (null != outputTarget) && ((base = outputTarget.getSystemId()) != null) ) {
        base = urlToFileName(base);
      }
      else
      {
        base = urlToFileName(transformer.getBaseURLOfSource());
View Full Code Here

      {
         TransformerFactory tfactory = TransformerFactory.newInstance();
         Transformer xform = tfactory.newTransformer();
         Source src = new DOMSource(e);
         java.io.StringWriter writer = new StringWriter();
         Result result = new javax.xml.transform.stream.StreamResult(writer);
         xform.transform(src, result);
         return writer.toString();
      }
      catch (Exception ex)
      {
View Full Code Here

                    if (is != null) {
                        return getBytesFromStream(is);
                    }
                }
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                Result result = new StreamResult(out);
                Transformer transformer = TransformerFactory.newInstance().newTransformer();
                transformer.transform((Source) arg, result);
                byte[] bytes = out.toByteArray();
                return bytes;
View Full Code Here

                if (is != null) {
                    bytes = getBytesFromStream(is);
                }
            } else {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                Result result = new StreamResult(out);
                Transformer transformer = TransformerFactory.newInstance().newTransformer();
                transformer.transform(data, result);
                bytes = out.toByteArray();
            }           
        } catch (OMException e) {
View Full Code Here

   {
      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      transformer.setOutputProperties(format);
      StringWriter writer = new StringWriter();
      Source source = new DOMSource(doc);
      Result result = new StreamResult(writer);
      transformer.transform(source, result);
      return writer.toString();
   }
View Full Code Here

        XMLStreamWriter sw = xmlOutputFactory.createXMLStreamWriter(xmlOutStream);
        xml.output(sw);
       
        //convert output stream to byte array and read back in as inputstream
        Source source = new StreamSource(new ByteArrayInputStream(xmlOutStream.toByteArray()));
        Result rstream = new StreamResult(xsltOutStream);
       
        //apply the xslt
        transformer.transform(source,rstream);
       
        //send to the providedOutpuStream
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.