Package javax.xml.transform

Examples of javax.xml.transform.Transformer


      Document svgDoc = provider.getDOM();

      Source source = new DOMSource(svgDoc);
      StringWriter outWriter = new StringWriter();
      Result output = new StreamResult(outWriter);
      Transformer transformer = TransformerFactory.newInstance()
          .newTransformer();
      transformer.transform(source, output);

      String svgString = outWriter.toString();
      return new BatikRenderer(svgString, null);
    }
    catch (Exception e)
View Full Code Here


        of transformation instructions, without penalizing runtime
        transformation.
      */
      Templates templates = transformerFactory.newTemplates( template );

      Transformer transformer = templates.newTransformer();
      if( outputProps != null )
      {
         transformer.setOutputProperties( outputProps );
      }

      transformer.transform( source, result );
   }
View Full Code Here

      StreamSource template = new StreamSource( templateIs );

      Templates templates = transformerFactory.newTemplates( template );

      // set output properties
      Transformer transformer = templates.newTransformer();
      if(outputProps != null)
      {
         transformer.setOutputProperties(outputProps);
      }

      // set xsl parameters
      if(xslParams != null)
      {
         // note, xslParams.keys() will not work properly,
         // because it will not return the keys for default properties.
         Enumeration keys = xslParams.propertyNames();
         while( keys.hasMoreElements() )
         {
            String key = (String)keys.nextElement();
            transformer.setParameter(key, xslParams.getProperty(key));
         }
      }

      transformer.transform( source, result );
   }
View Full Code Here

        MODSDatabase md = new MODSDatabase(database, keySet);

        try {
            DOMSource source = new DOMSource(md.getDOMrepresentation());
            StreamResult result = new StreamResult(ps);
            Transformer trans = TransformerFactory.newInstance().newTransformer();
            trans.setOutputProperty(OutputKeys.INDENT, "yes");
            trans.transform(source, result);
        }
        catch (Exception e) {
            throw new Error(e);
        }
View Full Code Here

        // PS: DOES NOT SUPPORT EXPORTING ONLY A SET OF ENTRIES

        try {
            DOMSource source = new DOMSource(md.getDOMrepresentation());
            StreamResult result = new StreamResult(ps);
            Transformer trans = TransformerFactory.newInstance().newTransformer();
            trans.setOutputProperty(OutputKeys.INDENT, "yes");
            trans.transform(source, result);
        }
        catch (Exception e) {
            throw new Error(e);
        }
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

            try {

                //            Writer ps = new FileWriter(tmpFile);
                DOMSource source = new DOMSource(od.getDOMrepresentation());
                StreamResult result = new StreamResult(ps);
                Transformer trans = TransformerFactory.newInstance().newTransformer();
                trans.setOutputProperty(OutputKeys.INDENT, "yes");
                trans.transform(source, result);
            } finally {
                ps.close();
            }
        } catch (Exception e) {
            throw new Error(e);
View Full Code Here

            try {

                //            Writer ps = new FileWriter(tmpFile);
                DOMSource source = new DOMSource(od.getDOMrepresentation());
                StreamResult result = new StreamResult(ps);
                Transformer trans = TransformerFactory.newInstance().newTransformer();
                trans.setOutputProperty(OutputKeys.INDENT, "yes");
                trans.transform(source, result);
            } finally {
                ps.close();
            }
        } catch (Exception e) {
            throw new Error(e);
View Full Code Here

    
      DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      Document doc = builder.parse(new InputSource(new StringReader(xml)));  
     
      TransformerFactory transformerFactory = TransformerFactory.newInstance();
      Transformer transformer = transformerFactory.newTransformer();
     
      StringWriter xmlout = new StringWriter();
      StreamResult result = new StreamResult(xmlout);

      transformer.transform(new DOMSource(doc.getFirstChild()), result);
     
      ManagedConnectionPoolStatistics rawStatistics = (ManagedConnectionPoolStatistics)getServer().invoke(POOL_NAME, RAW_STATS_METHOD, new Object[0], new String[0]);
      JBossXmlSubPoolStatisticFormatter xmlFormatter = new JBossXmlSubPoolStatisticFormatter();
      String xml2 = (String)xmlFormatter.formatSubPoolStatistics(rawStatistics);
     
      Document doc2 = builder.parse(new InputSource(new StringReader(xml2)));


      StringWriter xmlout2 = new StringWriter();
      StreamResult result2 = new StreamResult(xmlout2);

      transformer.transform(new DOMSource(doc2.getFirstChild()), result2);
     
      //only compare xml content, ignore standalone="no"
      assertEquals(xmlout.toString(), xmlout2.toString());

      conn.close();
View Full Code Here

     
      // Prepare the output
      Result result = new StreamResult(out);
     
      // Write the DOM document to the file
      Transformer xformer = TransformerFactory.newInstance().newTransformer();
     
      // Enable indentation
      xformer.setOutputProperty(OutputKeys.INDENT, "yes");
     
      try
      {
         xformer.transform(source, result);
      }
      finally
      {
         // Cleanup
         out.close();
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.