Examples of TransformerFactory


Examples of javax.xml.transform.TransformerFactory

    private synchronized void writeToFile()
    {
        // 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

    this.reloadStyleSheet();
  }

  public void reloadStyleSheet() throws TransformerConfigurationException {

    TransformerFactory transFact = TransformerFactory.newInstance();

    if(uriResolver != null){
      transFact.setURIResolver(uriResolver);
    }

    this.templates = transFact.newTemplates(new StreamSource(uri.toString()));
  }
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

        final OutputStreamWriter osw = new OutputStreamWriter(zos);

        Thread.currentThread()
                .setContextClassLoader(getClass().getClassLoader());

        TransformerFactory tf = TransformerFactory.newInstance();
        if (!tf.getFeature(SAXSource.FEATURE)
                || !tf.getFeature(SAXResult.FEATURE))
        {
            return 0;
        }

        SAXTransformerFactory saxtf = (SAXTransformerFactory) tf;
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

      }
    }
  }

  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

            if (jobContent == null || jobContent.length() == 0) {
              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

        String key = "javax.xml.transform.TransformerFactory";
        String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
        Properties props = System.getProperties();
        props.put(key, value);
        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

   * @throws Exception
   */
  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

  FileNotFoundException, IOException, Exception {
   
    if ( data.length() == 0 throw (new Exception("SOSXMLTransformer: no xml document contained in data." ));
    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(new StringReader(data)),
        new StreamResult(new FileOutputStream(outputFile)));
  }
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

  FileNotFoundException, IOException, Exception {
   
    if ( !xmlFile.exists() )  throw (new Exception("SOSXMLTransformer: no file found containing xml document." ));
    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(new FileInputStream(xmlFile)),
        new StreamResult(new FileOutputStream(outputFile)));
  }
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

  FileNotFoundException, IOException, Exception {
   
    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
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.