Package javax.xml.transform

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


    public boolean sendDocument(Document document) {
        try {
            //Get String from Document
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
            transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
            StringWriter sw = new StringWriter();
            StreamResult result = new StreamResult(sw);
            DOMSource source = new DOMSource(document);
View Full Code Here


            DOMSource source = new DOMSource(_cipangoConfig);

            CharArrayWriter writer = new CharArrayWriter();
            StreamResult result = new StreamResult(writer);
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer();
            transformer.transform(source, result);
            String _xmlConfigString = writer.toString();

            // get rid of the first line, as this will be prepended by
            // the XmlConfiguration
View Full Code Here

      DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
      //documentBuilder.setEntityResolver(new EasipEntityResolver());
     
      Node doc = documentBuilder.parse(new ByteArrayInputStream(source));
     
      Transformer transformer = factory.newTransformer(
          new StreamSource(getClass().getResourceAsStream("dataToSvg.xsl")));
      transformer.transform(new DOMSource(doc), result);
      return os.toByteArray();
    }
    catch (Throwable e)
View Full Code Here

      String xsltSystemId = getCanonicalURL(pageContext, _xsltSystemId);
     
      Source source = getSource(_xslt, xsltSystemId);

      Transformer transformer = factory.newTransformer(source);
      // transformer.setOutputProperty("omit-xml-declaration", "yes");

      for (int i = 0; i < _paramNames.size(); i++) {
        String name = _paramNames.get(i);
        String value = _paramValues.get(i);
View Full Code Here

      TransformerFactory factory = TransformerFactory.newInstance();

      Source source = getSource(_xslt, _xsltSystemId);

      Transformer transformer = factory.newTransformer(source);

      for (int i = 0; i < _paramNames.size(); i++) {
        String name = _paramNames.get(i);
        String value = _paramValues.get(i);
View Full Code Here

  private static Transformer getTransformer()
    throws TransformerException
  {
    if (_transformer == null) {
      TransformerFactory factory = TransformerFactory.newInstance();
      _transformer = factory.newTransformer();
    }

    return _transformer;
  }
}
View Full Code Here

        FileWriter outFileWriter = new FileWriter(outFile);
        StreamResult outStreamResult = new StreamResult(outFileWriter);

        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer(xslStreamSource);

        transformer.transform(xmlStreamSource, outStreamResult);
        outFileWriter.flush();
    }
View Full Code Here

    }

    public static void writeXml(Node n, OutputStream os) throws TransformerException {
        TransformerFactory tf = TransformerFactory.newInstance();
        // identity
        Transformer t = tf.newTransformer();
        t.setOutputProperty(OutputKeys.INDENT, "yes");
        t.transform(new DOMSource(n), new StreamResult(os));
    }

    public static DocumentBuilder createDocumentBuilder() {
View Full Code Here

            SAXResult saxResult = new SAXResult(this);
            skipEvents = true;
            TransformerFactory transformerFactory = TransformerFactory.newInstance();
            Transformer transformer;
            try {
                transformer = transformerFactory.newTransformer();
                if (xpointer == null) {
                    transformer.transform(new DOMSource(document, document.getDocumentURI()), saxResult);
                } else {
                    NodeList nodeList = evaluateXPointer(xpointer, document);
                    for (int i = 0; i < nodeList.getLength(); i++) {
View Full Code Here

        InputProcessorChainImpl inputProcessorChain = new InputProcessorChainImpl(securityContext);
        inputProcessorChain.addProcessor(new EventReaderProcessor());
        XMLSecurityStreamReader xmlSecurityStreamReader = new XMLSecurityStreamReader(inputProcessorChain, securityProperties);
        //use the sun internal TransformerFactory since the current xalan version don't know how to handle StaxSources:
        TransformerFactory transformerFactory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl", this.getClass().getClassLoader());
        javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        transformer.transform(new StAXSource(xmlSecurityStreamReader), new StreamResult(baos));
        XMLAssert.assertXMLEqual(readTestFile(), baos.toString("UTF-8"));
    }
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.