Examples of newTransformer()


Examples of javax.xml.transform.TransformerFactory.newTransformer()

  }

  public final void print(Document document) throws Exception
  {
    TransformerFactory factory = TransformerFactory.newInstance();
    javax.xml.transform.Transformer serializer = factory.newTransformer();
    serializer.transform(new DOMSource(document), new StreamResult(System.out));
    System.out.println();
  }

  /**
 
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

    {
        // Write the DOM back to file
        try
        {
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer m = tf.newTransformer();
            DOMSource source = new DOMSource(doc);
            FileOutputStream os = new FileOutputStream(fileUrl.getFile());
            StreamResult result = new StreamResult(os);
            m.setOutputProperty(OutputKeys.INDENT, "yes");
            m.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, XMLAutoStarterEntityResolver.PUBLIC_ID_KEY);
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

  private void saveXml(String fileName){
     TransformerFactory transFactory=TransformerFactory.newInstance();
     Transformer transformer = null;
    try {
      transformer = transFactory.newTransformer();
      transformer.setOutputProperty("indent", "yes");
          DOMSource source=new DOMSource();
          source.setNode(doc);
          StreamResult result=new StreamResult();
          FileOutputStream fileOutputStream =  new FileOutputStream(fileName);
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

              if (this.getLog() != null) this.getLog().warn("no job configuration found for managed job: " + currJob.get("id"));
              continue;
            }*/
//        set up a transformer
                TransformerFactory transfac = TransformerFactory.newInstance();
                Transformer trans = transfac.newTransformer();
                trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
                trans.setOutputProperty(OutputKeys.INDENT, "yes");

                //create string from xml tree
                StringWriter sw = new StringWriter();
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

        System.setProperties(props);
        TransformerFactory tFactory = TransformerFactory.newInstance();
        tFactory.setAttribute("translet-name", "managed2live");
        tFactory.setAttribute("package-name", "sos.scheduler.translet");
        tFactory.setAttribute("use-classpath", Boolean.TRUE);
        managed2liveTransformer = tFactory.newTransformer(new StreamSource("managed2live.xsl"));       
      } catch (Exception e){
        spooler_log.error("Failed to initialize translet: "+e);
        if (this.getConnection() !=  null) {
          try { this.getConnection().rollback(); } catch (Exception ex) {} // no error handling
          try { this.getConnection().disconnect(); } catch (Exception ex) {} // no error handling
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

   */
  public void Transform(final File xslFile, final File outputFile) throws TransformerException,
  TransformerConfigurationException, FileNotFoundException, Exception {

    final TransformerFactory tFactory = TransformerFactory.newInstance();
    final Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));

    if (outputFile == null) {
      transformer.transform(new StreamSource(this)// ...
          new StreamResult(new java.io.OutputStreamWriter(System.out)));
    }
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

   
    if ( stream == null throw (new Exception("SOSXMLTransformer: no xml document contained in stream." ));
    if ( !xslFile.exists() )  throw (new Exception("SOSXMLTransformer: no file found containing stylesheet." ));
   
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
    addParameters(transformer, parameters);
    transformer.transform(stream,
        new StreamResult(new FileOutputStream(outputFile)));
  }
 
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

   
    if ( stream == null throw (new Exception("SOSXMLTransformer: no xml document contained in stream." ));
    if ( !xslFile.exists() )  throw (new Exception("SOSXMLTransformer: no file found containing stylesheet." ));
   
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
    addParameters(transformer, parameters);
    transformer.transform(new StreamSource(stream),
        new StreamResult(new FileOutputStream(outputFile)));
  }
 
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source stylesheet = tFactory.getAssociatedStylesheet(stream, null, null, null);
   
    if ( stylesheet == null throw (new Exception("SOSXMLTransformer: no stylesheet found in input file." ));
   
    Transformer transformer = tFactory.newTransformer(stylesheet);
    addParameters(transformer, parameters);
    transformer.transform(stream,
        new StreamResult(new FileOutputStream(outputFile)));
  }
 
View Full Code Here

Examples of javax.xml.transform.TransformerFactory.newTransformer()

    if ( data.length() == 0 throw (new Exception("SOSXMLTransformer: no xml document contained in data." ));
    if ( stylesheetStream == null throw (new Exception("SOSXMLTransformer: no stylesheet contained in stream." ));
   
    TransformerFactory tFactory = TransformerFactory.newInstance();
       
    Transformer transformer = tFactory.newTransformer(stylesheetStream);
    addParameters(transformer, parameters);
    transformer.transform(new StreamSource(new StringReader(data)),
        new StreamResult(new FileOutputStream(outputFile)));
  }
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.