Examples of XSLProcessorImpl


Examples of com.jclark.xsl.sax.XSLProcessorImpl

   public void xmlOutput( String xmlData, String dir, String template, HttpServletResponse response ) throws ServletException
   {
      try {
         response.setContentType("text/html");

         XSLProcessorImpl xsl = getStylesheet( dir, template );
         OutputMethodHandlerImpl outputMethodHandler =
                                      new OutputMethodHandlerImpl(xsl);

         xsl.setOutputMethodHandler(outputMethodHandler);

         outputMethodHandler.setDestination( new ServletDestination(response) );

         xsl.parse( new InputSource( new StringReader( xmlData ) ) );

      }
      catch(Exception e) {
         log.warning("servlet output broken:"+e.toString());
         throw new ServletException(e.toString());
View Full Code Here

Examples of com.jclark.xsl.sax.XSLProcessorImpl

   public void fileXmlOutput( String fileName, String dir, String template, HttpServletResponse response ) throws ServletException
   {
      try {
         response.setContentType("text/html");

         XSLProcessorImpl xsl = getStylesheet( dir, template );
         OutputMethodHandlerImpl outputMethodHandler =
                                      new OutputMethodHandlerImpl(xsl);

         xsl.setOutputMethodHandler(outputMethodHandler);

         outputMethodHandler.setDestination( new ServletDestination(response) );

         xsl.parse( new InputSource( (new URL( "file:"+fileName )).toString() ) );

      }
      catch(Exception e) {
         log.warning("servlet output broken:"+e.toString());
         throw new ServletException(e.toString());
View Full Code Here

Examples of com.jclark.xsl.sax.XSLProcessorImpl

   public XSLProcessorImpl getStylesheet( String reqDir, String xslFile ) throws XmlBlasterException, IOException
   {

      String xslPath = reqDir+"/"+xslFile+".xsl";

      XSLProcessorImpl xsl  = new XSLProcessorImpl();
      xsl.setParser(createParser());

      try {
         String url = new URL("file", "", xslPath).toString();
         log.info("Reading from "+url);
         xsl.loadStylesheet( new InputSource( new URL("file", "", xslPath).toString() ) );
         log.info("Successfully read from "+url);
      }
      catch ( Exception e) {
         log.severe(e.toString());
         throw new XmlBlasterException(ME,"Could not read XSL file.");
View Full Code Here

Examples of com.jclark.xsl.sax.XSLProcessorImpl

  if (parser == null) {
      MessageHandler.errorln("ERROR: Unable to create SAX parser");
      System.exit(1);
  }
 
  XSLProcessor xslProcessor = new XSLProcessorImpl();
  xslProcessor.setParser(parser);
 
  try {
      xslProcessor.loadStylesheet(fileInputSource(args[1]));

      XTDriver driver = new XTDriver();
      driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
             version);
      driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
View Full Code Here

Examples of com.jclark.xsl.sax.XSLProcessorImpl

  if (parser == null) {
      System.err.println("ERROR: Unable to create SAX parser");
      System.exit(1);
  }
 
  XSLProcessor xslProcessor = new XSLProcessorImpl();
  xslProcessor.setParser(parser);
 
  try {
      xslProcessor.loadStylesheet(fileInputSource(args[1]));

      Driver driver = new Driver();
      driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
             version);
      driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
View Full Code Here

Examples of com.jclark.xsl.sax.XSLProcessorImpl

  if (parser == null) {
      MessageHandler.errorln("ERROR: Unable to create SAX parser");
      System.exit(1);
  }
 
  XSLProcessor xslProcessor = new XSLProcessorImpl();
  xslProcessor.setParser(parser);
 
  try {
      xslProcessor.loadStylesheet(fileInputSource(args[1]));

      XTDriver driver = new XTDriver();
      driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
             version);
      driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
View Full Code Here

Examples of com.jclark.xsl.sax.XSLProcessorImpl

  if (parser == null) {
      System.err.println("ERROR: Unable to create SAX parser");
      System.exit(1);
  }
 
  XSLProcessor xslProcessor = new XSLProcessorImpl();
  xslProcessor.setParser(parser);
 
  try {
      xslProcessor.loadStylesheet(fileInputSource(args[1]));

      Driver driver = new Driver();
      driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
             version);
      driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
View Full Code Here

Examples of com.jclark.xsl.sax2.XSLProcessorImpl

     */
    public TransformerImpl(Sheet sheet, Engine engine,
                           TransformerFactoryImpl factory)
    {
        _sheet = sheet;
        _processor = new XSLProcessorImpl(sheet, engine);
        _factory = factory;
    }
View Full Code Here

Examples of com.jclark.xsl.sax2.XSLProcessorImpl

   
    protected XSLProcessorImpl init(Result result)
        throws TransformerException
    {
       
        XSLProcessorImpl processor = (XSLProcessorImpl) _processor.clone();
       
        if (result instanceof StreamResult) {
            StreamResult sr = (StreamResult) result;
           
            OutputMethodHandlerImpl outputMethodHandler =
                new OutputMethodHandlerImpl();
           
            processor.setOutputMethodHandler(outputMethodHandler);
            Destination dest;
            OutputStream ostream = sr.getOutputStream();
            if (ostream != null) {

                dest = new OutputStreamDestination(ostream);
            } else {
                // FIXME: we need to handle a characterWriter
                throw new TransformerException("cannot use Writer result");
            }
           
            outputMethodHandler.setDestination(dest);
           
        } else if (result instanceof SAXResult) {

            SAXResult sr = (SAXResult) result;
            processor.setContentHandler(sr.getHandler());
            // FIXME: set lexical handler?
        } else {
            throw new TransformerException("unrecognized Result class: " +
                                           result.getClass().getName());
        }
View Full Code Here

Examples of com.jclark.xsl.sax2.XSLProcessorImpl

     */
    public void transform(Source source, Result result)
        throws TransformerException
    {
       
        XSLProcessorImpl processor = init(result);
       
        try {
            // now find an adapter for the input source
            XMLReader reader = _factory.getReader(source);
            processor.setSourceReader(reader);
            String sysId = source.getSystemId();
            InputSource src = SAXSource.sourceToInputSource(source);
            if (src == null) {
                if (sysId == null) {
                    src = new InputSource("dummy");
                } else {
                    src = new InputSource(sysId);
                }
            }
           
            // FIXME: set error handler
            processor.parse(src);
           
        } catch (Exception ex) {
            throw new TransformerException(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.