Package javax.xml.transform

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


      if(systemId != null)
          xslStreamSource = new StreamSource(new StringReader(xslString), systemId);
      else
          xslStreamSource = new StreamSource(new StringReader(xslString));

      Transformer transformer = transformerFactory.newTransformer(xslStreamSource);
      if(props != null) {
          Iterator iter = props.entrySet().iterator();
          while(iter.hasNext()) {
              Entry entry = (Entry)iter.next();
              transformer.setParameter((String)entry.getKey(), (String)entry.getValue());
View Full Code Here


    TransformerFactory tfactory = TransformerFactory.newInstance();
    // This creates a transformer that does a simple identity transform,
    // and thus can be used for all intents and purposes as a serializer.
    try
    {
      serializer = tfactory.newTransformer();
      serializer.setOutputProperty(OutputKeys.INDENT, "yes");
      serializer.setOutputProperty(OutputKeys.METHOD, "xml");
      serializer.setOutputProperty(OutputKeys.ENCODING, Constants
          .getXMLEncoding());
      if ((systemID != null) && (systemID.length() > 0))
View Full Code Here

                final Source xmlSource = new DOMSource(this.urlToDocument(xmlDocument));
                final TransformerFactory factory = TransformerFactory.newInstance();
                if (xslt != null)
                {
                    final Source xsltSource = new StreamSource(xslt.openStream());
                    final javax.xml.transform.Transformer transformer = factory.newTransformer(xsltSource);
                    final ByteArrayOutputStream output = new ByteArrayOutputStream();
                    final Result result = new StreamResult(output);
                    transformer.transform(
                        xmlSource,
                        result);
View Full Code Here

            StreamSource xml = new StreamSource( xmlstream );

            /* Transform */
            StreamResult output = new StreamResult( response.getWriter(  ) );
            Transformer  transformer = factory.newTransformer( xsl );
            Map          params = getXslParameters( request, response );
            if ( params != null )
            {
                Iterator it = params.keySet(  ).iterator(  );
                while ( it.hasNext(  ) )
View Full Code Here

          * this causes problems;
          * so we convert the stylesheet to byte[] and use this as input stream
          */
         {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            Transformer transformer = tFactory.newTransformer();
            DOMSource source = new DOMSource(_xsltElement);
            StreamResult result = new StreamResult(os);

            transformer.transform(source, result);

View Full Code Here

            stylesheet =
               new StreamSource(new ByteArrayInputStream(os.toByteArray()));
         }

         Transformer transformer = tFactory.newTransformer(stylesheet);
         if (baos==null) {
               ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
               StreamResult outputTarget = new StreamResult(baos1);
               transformer.transform(xmlSource, outputTarget);
               return new XMLSignatureInput(baos1.toByteArray());
View Full Code Here

        StreamResult streamResult = new StreamResult(stringWriter);

        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer;
        try {
            transformer = transformerFactory.newTransformer();
        } catch (TransformerConfigurationException e) {
            throw new IllegalStateException("Unable to get a new transformer", e);
        }

        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
View Full Code Here

    // Once again we are using a factory of some sort,
    // this time for getting a Transformer instance,
    // which we use to output the XML
    TransformerFactory transformerFactory = TransformerFactory
        .newInstance();
    Transformer transformer = transformerFactory.newTransformer();

    // Indenting the XML
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");

    // The actual output to a file goes here
View Full Code Here

    public static void printDocument(Document document, String fname){
        try{

            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer transformer = tf.newTransformer();
            DOMSource source = new DOMSource(document);
            StreamResult result;

            if (fname == null)
                result = new StreamResult(System.out);
View Full Code Here

         return null;

      // Get a parsable representation of this elements content
      DOMSource source = new DOMSource(content);
      TransformerFactory tFactory = TransformerFactory.newInstance();
      Transformer transformer = tFactory.newTransformer();
      StringWriter sw = new StringWriter();
      StreamResult result = new StreamResult(sw);
      transformer.transform(source, result);
      sw.close();
      return sw.getBuffer();
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.