Package com.jclark.xsl.sax2

Examples of com.jclark.xsl.sax2.OutputMethodHandlerImpl


        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());
View Full Code Here


    {

        try {
            XMLReader reader = getReader(source);
            TemplatesHandler th =
                new TemplatesHandlerImpl(this, new XMLProcessorImpl(reader));
           
            String sysId = source.getSystemId();
           
            th.setSystemId(sysId);
            reader.setContentHandler(th);
View Full Code Here

     */
    public TemplatesHandler newTemplatesHandler()
        throws TransformerConfigurationException
    {
        try {
            return new TemplatesHandlerImpl(this, new XMLProcessorImpl());
        } catch(Exception e) {
            throw toConfigException(e);
        }
    }
View Full Code Here

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

   
    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

     */
    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

Related Classes of com.jclark.xsl.sax2.OutputMethodHandlerImpl

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.