Examples of TransformerFactory


Examples of com.dotcms.repackage.javax.xml.transform.TransformerFactory

        }

        Source xsltSource = new StreamSource(new InputStreamReader(new FileInputStream(binFile), "UTF8"));

        // create an instance of TransformerFactory
        TransformerFactory transFact = TransformerFactory.newInstance();
        StreamResult result = new StreamResult(new ByteArrayOutputStream());
        Transformer trans = transFact.newTransformer(xsltSource);

        try{
          trans.transform(xmlSource, result);
        }catch(Exception e1){
          Logger.error(XsltTool.class, "Error in transformation. "+e1.getMessage());
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

        return sb.toString();       
    }
   
  public static String prettyPrint(SQLXML xml) throws SQLException {
    try {
      TransformerFactory transFactory = TransformerFactory.newInstance();
      transFactory.setAttribute("indent-number", new Integer(2)); //$NON-NLS-1$
     
      Transformer tf = transFactory.newTransformer();
      tf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$
      tf.setOutputProperty(OutputKeys.ENCODING, "UTF-8");//$NON-NLS-1$
      tf.setOutputProperty(OutputKeys.INDENT, "yes");//$NON-NLS-1$
      tf.setOutputProperty(OutputKeys.METHOD, "xml");//$NON-NLS-1$
      tf.setOutputProperty(OutputKeys.STANDALONE, "yes");//$NON-NLS-1$
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

  }

  private static void transformConfig(File config, String styleSheet, Result target)
      throws TransformerFactoryConfigurationError,
      TransformerConfigurationException, TransformerException {
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer(new StreamSource(MigrationUtil.class.getResourceAsStream(styleSheet)));
    t.setParameter("version", ApplicationInfo.getInstance().getReleaseNumber()); //$NON-NLS-1$
    t.transform(new StreamSource(config), target);
  }
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

            throw new WsException("Error parsing supplied WSDL: " + e.getMessage());
        }

        ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
        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) {
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

    public static String getDocumentAsString(Document doc)
            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

Examples of javax.xml.transform.TransformerFactory

    Source xmlSource = null;
    try {
      styleSource = convertToSource(styleSheet);
      xmlSource = convertToSource(xml);
      final Source xmlParam = xmlSource;
      TransformerFactory factory = TransformerFactory.newInstance();
            final Transformer transformer = factory.newTransformer(styleSource);
           
      //this creates a non-validated sqlxml - it may not be valid xml/root-less xml
      SQLXMLImpl result = XMLSystemFunctions.saveToBufferManager(context.getBufferManager(), new XMLTranslator() {
       
        @Override
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

        if (target == null) {
            return null;
        }
       
        try {
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            StringWriter output = new StringWriter();
            transformer.transform(new DOMSource(target), new StreamResult(output));
           
            return output.toString();
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

public class Xml2HtmlTransformer extends XmlTransformer {
   
    @Override
    public void transform() throws Exception {
        TransformerFactory factory = TransformerFactory.newInstance();
        FileOutputStream fos = new FileOutputStream(target.toString());
        javax.xml.transform.Transformer transformer =
                              factory.newTransformer(new StreamSource(template.toString()));
        transformer.transform(new StreamSource(source.toString()),
                              new StreamResult(fos));
       
        fos.close();
    }
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

        OutputStream out = new FileOutputStream(target);
        out = new BufferedOutputStream(out);
       
        try {
            Fop fop = fopFactory.newFop(MimeConstants.MIME_RTF, foUserAgent, out);
            TransformerFactory factory = TransformerFactory.newInstance();
           
            javax.xml.transform.Transformer transformer =
                    factory.newTransformer(new StreamSource(template));
           
            transformer.setErrorListener(this);
            transformer.setParameter("versionParam", "1.0");
            transformer.transform(new StreamSource(source), new SAXResult(fop.getDefaultHandler()));
        } finally {
View Full Code Here

Examples of javax.xml.transform.TransformerFactory

        OutputStream out = new FileOutputStream(target);
        out = new BufferedOutputStream(out);
       
        try {
            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
            TransformerFactory factory = TransformerFactory.newInstance();
           
            javax.xml.transform.Transformer transformer =
                    factory.newTransformer(new StreamSource(template));
           
            transformer.setErrorListener(this);
            transformer.setParameter("versionParam", "1.0");
            transformer.transform(new StreamSource(source), new SAXResult(fop.getDefaultHandler()));
        } finally {
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.