Package javax.xml.transform

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


      // Use the factory to create a template containing the xsl file
      Templates template = factory.newTemplates(new StreamSource(
          new FileInputStream(xslfile)));

      // Use the template to create a transformer
      Transformer xformer = template.newTransformer();
     
      // passing 2 parameters
      String branch = outfile.getParentFile().getCanonicalPath().substring(root.length());
      branch = branch.replace(File.separatorChar, '/');
      StringBuffer path = new StringBuffer();
View Full Code Here


    removeSkipEvaluation(context);

    try {
      DOMSource domSource = getDOMSource(context);
      Templates templates = getTemplates(context);
      Transformer transformer = templates.newTransformer();
      setParams(transformer, context);

      StringWriter writer = new StringWriter();
      transformer.transform(domSource, new StreamResult(writer));
      String result = writer.toString();
View Full Code Here

            if (UtilValidate.isNotEmpty(templateName)) {
                    xslTemplatesCache.put(templateName, translet);
            }
        }
        if (translet != null ) {
            Transformer transformer = translet.newTransformer();
            if (params != null) {
                for (Map.Entry<String, Object> entry: params.entrySet()) {
                       String key = (String)entry.getKey();
                    Object val = entry.getValue();
                    transformer.setParameter(key, val);
View Full Code Here

  public javax.xml.transform.Transformer newTransformer(Source source)
    throws TransformerConfigurationException
  {
    Templates templates = newTemplates(source);

    return templates.newTransformer();
  }

  /**
   * Create an identity transformer.
   *
 
View Full Code Here

      /*
       * Use the TransformerFactory to process the stylesheet Source and
       * generate a Transformer.
       */
      final Transformer transformer = template.newTransformer();

      /* set the global variables */
      if (globalParameters != null)
        for (final String varibleName : globalParameters.keySet())
          transformer.setParameter(varibleName, globalParameters.get(varibleName));
View Full Code Here

          }
        }

        if (null != stylesheet)
        {
          Transformer transformer = flavor.equals("th") ? null : stylesheet.newTransformer();

          // Override the output format?
          if (null != outputType)
          {
            transformer.setOutputProperty(OutputKeys.METHOD, outputType);
View Full Code Here

         The spec says: "a Transformer must use this interface
         instead of throwing an exception" - the newTemplates() does
         that, and returns null.
      */
      if( tmpl==null ) return null;
      Transformer transformer = tmpl.newTransformer();
      transformer.setURIResolver(m_uriResolver);
      return transformer;
    } catch( TransformerConfigurationException ex ) {
      if( m_errorListener != null ) {
        try {
View Full Code Here

     */
    public Transformer newTransformer(Source source) throws
  TransformerConfigurationException
    {
  final Templates templates = newTemplates(source);
  final Transformer transformer = templates.newTransformer();
  if (_uriResolver != null) {
      transformer.setURIResolver(_uriResolver);
  }
  return(transformer);
    }
View Full Code Here

         The spec says: "a Transformer must use this interface
         instead of throwing an exception" - the newTemplates() does
         that, and returns null.
      */
      if( tmpl==null ) return null;
      Transformer transformer = tmpl.newTransformer();
      transformer.setURIResolver(m_uriResolver);
      return transformer;
    } catch( TransformerConfigurationException ex ) {
      if( m_errorListener != null ) {
        try {
View Full Code Here

          }
        }

        if (null != stylesheet)
        {
          Transformer transformer = flavor.equals("th") ? null : stylesheet.newTransformer();

          // Override the output format?
          if (null != outputType)
          {
            transformer.setOutputProperty(OutputKeys.METHOD, outputType);
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.