Package javax.xml.transform

Examples of javax.xml.transform.Result


      try {
         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) {
         return "Unable to convert to string: " + ex.toString();
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

    // Source document is the XML generated from the BugCollection
    final Source source = new DocumentSource(document);

    // Write result to output stream
    final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(fileName), Charset.forName("UTF-8").newEncoder());
    final Result result = new StreamResult(writer);
    // Do the transformation
    transformer.transform(source, result);
    return writer;

  }
View Full Code Here

      try {
         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) {
         return "Unable to convert to string: " + ex.toString();
View Full Code Here

      transformer.setOutputProperty(OutputKeys.INDENT, "yes");
      transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");

      Source source = new DOMSource(document);
      Result result = new StreamResult(new OutputStreamWriter(new FileOutputStream(getOption("outFile"))));
      transformer.transform(source, result);
    } catch (Exception e) {
      // oops we cannot throw checked exceptions
      throw new RuntimeException(e);
    }
View Full Code Here

            catch ( IOException e )
            {
                throw new TransformerException( e );
            }

            Result res = null;
            try
            {
                Fop fop = FOP_FACTORY.newFop( MimeConstants.MIME_PDF, userAgent, out );
                res = new SAXResult( fop.getDefaultHandler() );
            }
View Full Code Here

                Node dataNode = datum.getNode();
                if (dataNode != null) {
                    StringWriter out = new StringWriter();
                    try {
                        Source input = new DOMSource(dataNode);
                        Result output = new StreamResult(out);
                        XFORMER.transform(input, output);
                    } catch (TransformerException te) {
                        org.apache.commons.logging.Log log = LogFactory.
                            getLog(SCXMLSerializer.class);
                        log.error(te.getMessage(), te);
View Full Code Here

            return buf.toString();
        }
        for (int i = 0; i < externalNodes.size(); i++) {
            Source input = new DOMSource((Node) externalNodes.get(i));
            StringWriter out = new StringWriter();
            Result output = new StreamResult(out);
            try {
                XFORMER.transform(input, output);
            } catch (TransformerException te) {
                org.apache.commons.logging.Log log = LogFactory.
                    getLog(SCXMLSerializer.class);
View Full Code Here

            for (RouteType routeType : routeTypes) {
                addJaxbElementToNode(root, routeType);
            }

            Result result = new StreamResult(new OutputStreamWriter(outputStream, XmlConverter.defaultCharset));

            copyToResult(converter, doc, result);
        } catch (ParserConfigurationException e) {
            throw new RuntimeTransformException(e);
        } catch (TransformerException e) {
View Full Code Here

        }
        Transformer transformer = getTemplate().newTransformer();
        configureTransformer(transformer, exchange);
        Source source = getSource(exchange);
        ResultHandler resultHandler = resultHandlerFactory.createResult();
        Result result = resultHandler.getResult();

        // lets copy the headers before we invoke the transform in case they modify them
        Message out = exchange.getOut(true);
        out.copyFrom(exchange.getIn());
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.