Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamResult


      tf.setOutputProperty(OutputKeys.METHOD, "xml");//$NON-NLS-1$
      tf.setOutputProperty(OutputKeys.STANDALONE, "yes");//$NON-NLS-1$
      tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      StreamResult xmlOut = new StreamResult(new BufferedOutputStream(out));
      tf.transform(xml.getSource(StreamSource.class), xmlOut);
     
      return out.toString();
    } catch (Exception e) {
      return xml.getString();
View Full Code Here


          int manifestBegin = manifestStr.indexOf("<xmi");
          configStr = configStr.substring(0, index) + manifestStr.substring(manifestBegin) + "</VDB>";
          FileUtils.write(configStr.getBytes(), config);
          manifest.delete();
        }
        transformConfig(config, "/vdb.xsl", new StreamResult(new File(metainf, "vdb.xml")));
        config.delete();
        FileOutputStream out = new FileOutputStream(new File(file.getParent(), fileName + "_70.vdb"));
        ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(out));
        int parentLength = dir.getPath().length();
        addDirectory(dir, zos, parentLength);
        zos.close();
      } finally {
        FileUtils.removeDirectoryAndChildren(dir);
      }
    } else if (ext.endsWith("xml") || ext.endsWith("def")){
      File parent = file.getParentFile();
      transformConfig(file, "/vdb.xsl", new StreamResult(new File(parent, fileName + "-vdb.xml")));
    } else {
      System.err.println(fullName + " is not a vdb or xml file.  Run with no arguments for help."); //$NON-NLS-1$
      System.exit(-1);
    }
  }
View Full Code Here

          new java.io.ByteArrayOutputStream();
       
      DOMSource source=new DOMSource();
      source.setNode(node);
     
      StreamResult result=new StreamResult(xmlstr);
     
      Transformer trans=
          TransformerFactory.newInstance().newTransformer();
      trans.transform(source, result);
     
View Full Code Here

        props.setProperty(SaxonOutputKeys.WRAP, "no");
        props.setProperty(OutputKeys.INDENT, "no");
        props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        StringWriter res_sw = new StringWriter();
        DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
        exp.run(dynamicContext, new StreamResult(res_sw), props);

        return res_sw.toString();
    }
View Full Code Here

            }
        } else if(result instanceof SAXResult) {
            ContentHandler handler = ((SAXResult) result).getHandler();
            writeItemToSAX(handler);
        } else if(result instanceof StreamResult) {
            StreamResult streamResult = (StreamResult) result;
            final Writer writer = streamResult.getWriter();
            if(writer == null) {
                OutputStream os = streamResult.getOutputStream();
                writeItem(os, new Properties());
            } else {
                writeItem(writer, new Properties());
            }
        } else {
View Full Code Here

        try {
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();

            DOMSource source = new DOMSource(doc);
            StreamResult result = new StreamResult(baos);
            transformer.transform(source, result);
        } catch (TransformerException e) {
            throw new WsException("Error transforming WSDL: " + e.getMessage());
        }
        return baos.toByteArray();
View Full Code Here

    private static class XSLTransformation {
        public static String transform(String stylesheet,
                                       String srcXMLString,
                                       HashMap<String, String> params) throws Exception {
            StringWriter writer = new StringWriter();
            StreamResult result = new StreamResult( writer );
            Source src = new StreamSource( new StringReader( srcXMLString ) );
            transform( stylesheet,
                       src,
                       result,
                       params );
View Full Code Here

            throws TransformerException {
        StringWriter writer = new StringWriter();

        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer();
        transformer.transform(new DOMSource(doc), new StreamResult(writer));

        return writer.toString();
    }
View Full Code Here

        }else if(DataHandler.class.isAssignableFrom(value.getClass())){
          ((DataHandler)value).writeTo(output);
        }else if(Source.class.isAssignableFrom(value.getClass())){
          try {
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.transform( ((Source)value), new StreamResult(output) );
          } catch (Throwable e) {
            //TODO LOG
            e.printStackTrace();
          }
         
View Full Code Here

          }
          try {
            Transformer t = TransformerFactory.newInstance().newTransformer();
            StringWriter writer = new StringWriter();
            //TODO: prevent this from being too large
                t.transform(source, new StreamResult(writer));
            String param = Util.httpURLEncode(this.executionFactory.getXMLParamName())+"="+Util.httpURLEncode(writer.toString()); //$NON-NLS-1$
            endpoint = WSConnection.Util.appendQueryString(endpoint, param);
          } catch (TransformerException e) {
            throw new WebServiceException(e);
          }
View Full Code Here

TOP

Related Classes of javax.xml.transform.stream.StreamResult

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.