Package javax.xml.transform

Examples of javax.xml.transform.Transformer


            throw Exceptions.sourceInstantiation(ex);
        } catch (ClassCastException ex) {
            throw Exceptions.sourceInstantiation(ex);
        }

        Transformer  transformer  = JDBCSQLXML.getIdentityTransformer();
        InputStream  stream       = this.getBinaryStreamImpl();
        StreamSource streamSource = new StreamSource();
        DOMResult    result       = new DOMResult();

        streamSource.setInputStream(stream);

        try {
            transformer.transform(streamSource, result);
        } catch (TransformerException ex) {
            throw Exceptions.transformFailed(ex);
        }
        source.setNode(result.getNode());
        source.setSystemId(result.getSystemId());
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();
                StreamResult result = new StreamResult(sw);
                DOMSource source = new DOMSource(jobDocument);
                trans.transform(source, result);
                String xmlString = sw.toString();

                try {
                    // Job ist evtl. in vorigem Job-Lauf angelegt worden
                    if (currJob.get("job_name") != null && this.spooler.job(currJob.get("job_name").toString()) != null) {
View Full Code Here

    }


    public static void writeXmlTo(Node n, Writer w) {
        try {
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.setOutputProperty("omit-xml-declaration", "false");   //TODO Funktioniert nur mit org.jdom?
            transformer.transform(new DOMSource(n), new StreamResult(w));
        } catch (TransformerException x) { throw new XmlException(x); }
    }
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)));
    }
    else {
//      final boolean append = true;
      transformer.transform(new StreamSource(this), // ...
          new StreamResult(new FileOutputStream(outputFile)));
    }

  }
View Full Code Here

   
    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

   
    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

   
    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

   
    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

    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

    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

Related Classes of javax.xml.transform.Transformer

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.