Package javax.xml.transform

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


          }
        }

        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


                                Source xml = new StreamSource(inputXml);
                                Source xsl = new StreamSource(xslResource.toExternalForm());
                                final StreamResult streamResult;
                                final Templates templates = TransformerFactory.newInstance().newTemplates(xsl);
                                streamResult = new StreamResult(pipedOut);
                                templates.newTransformer().transform(xml, streamResult);
                            } catch (TransformerConfigurationException e) {
                                throw new RuntimeException("Error initializing XSL transformer", e);
                            } catch (TransformerException e) {
                                throw new RuntimeException("Error transforming", e);
                            } finally {
View Full Code Here

        InputStream file = getInputStream(path);
        if (file != null)
        {
          XSLTProcessor.log(LogService.LOG_INFO,"Creating template for path "+path, null);
          Templates template = factory.newTemplates(new StreamSource(file));
          transformer = template.newTransformer();
          if (useCache)
          {
            templatesCache.put(path, template);
          }
        }
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 )
    {
View Full Code Here

      PrintWriter pw = new PrintWriter(new StringWriter());

      synchronized (m_tfactory)
      {
        Templates templates = m_tfactory.newTemplates(new StreamSource(xslbuf));
        Transformer transformer = templates.newTransformer();
        transformer.transform(new StreamSource(xmlbuf), new StreamResult(pw));
      }
      System.out.println("Primed the pump!");
      this.showStatus("Ready to go!");
    }
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

        try {
      StreamSource document = new StreamSource(xml);
           StreamResult result = new StreamResult(new OutputStreamWriter(System.out));
      Templates templates = readTemplates(translet);
      Transformer transformer = templates.newTransformer();
            transformer.transform(document, result);
        }
  catch (Exception e) {
            System.err.println("Exception: " + e);
      e.printStackTrace();
View Full Code Here

      PrintWriter pw = new PrintWriter(new StringWriter());

      synchronized (m_tfactory)
      {
        Templates templates = m_tfactory.newTemplates(new StreamSource(xslbuf));
        Transformer transformer = templates.newTransformer();
        transformer.transform(new StreamSource(xmlbuf), new StreamResult(pw));
      }
      System.out.println("Primed the pump!");
      this.showStatus("Ready to go!");
    }
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 )
    {
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.