Package javax.xml.transform

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


    
      DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      Document doc = builder.parse(new InputSource(new StringReader(xml)));  
     
      TransformerFactory transformerFactory = TransformerFactory.newInstance();
      Transformer transformer = transformerFactory.newTransformer();
     
      StringWriter xmlout = new StringWriter();
      StreamResult result = new StreamResult(xmlout);

      transformer.transform(new DOMSource(doc.getFirstChild()), result);
View Full Code Here


  }

  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

    NodeList list =
      step.getElementsByTagNameNS("http://chaperon.sourceforge.net/schema/text/1.0", "text");
    Node node = list.item(0);

    TransformerFactory streamerfactory = TransformerFactory.newInstance();
    Transformer streamer = streamerfactory.newTransformer();

    SAXTransformerFactory serializerfactory =
      (SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler serializer = serializerfactory.newTransformerHandler();
    DOMResult result = new DOMResult();
View Full Code Here

    if (node==null)
      return null;

    TransformerFactory streamerfactory = TransformerFactory.newInstance();
    Transformer streamer = streamerfactory.newTransformer();

    DOMResult result = new DOMResult();

    streamer.transform(new DOMSource(node), result);
View Full Code Here

  }

  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

    {
        // 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

  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

              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

        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

   */
  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

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.