santiagopg    02/05/28 12:35:27

  Modified:    java/src/org/apache/xalan/xsltc/cmdline Transform.java
               java/src/org/apache/xalan/xsltc/runtime/output
                        TransletOutputHandlerFactory.java
               java/src/org/apache/xalan/xsltc/trax SAX2DOM.java
                        TemplatesHandlerImpl.java TemplatesImpl.java
                        TransformerFactoryImpl.java TransformerImpl.java
  Log:
  Added 'experimental-output' attribute to transformer factory.
  
  Revision  Changes    Path
  1.19      +3 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java
  
  Index: Transform.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Transform.java    23 May 2002 14:52:09 -0000      1.18
  +++ Transform.java    28 May 2002 19:35:26 -0000      1.19
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Transform.java,v 1.18 2002/05/23 14:52:09 santiagopg Exp $
  + * @(#)$Id: Transform.java,v 1.19 2002/05/28 19:35:26 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -203,7 +203,8 @@
            }
   
            // Transform the document
  -         TransletOutputHandlerFactory tohFactory = 
TransletOutputHandlerFactory.newInstance();
  +         TransletOutputHandlerFactory tohFactory = 
  +             TransletOutputHandlerFactory.newInstance();
            tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
            tohFactory.setEncoding(_translet._encoding);
            tohFactory.setOutputMethod(_translet._method);
  
  
  
  1.7       +35 -16    
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/TransletOutputHandlerFactory.java
  
  Index: TransletOutputHandlerFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/TransletOutputHandlerFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TransletOutputHandlerFactory.java 28 May 2002 18:07:41 -0000      1.6
  +++ TransletOutputHandlerFactory.java 28 May 2002 19:35:26 -0000      1.7
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransletOutputHandlerFactory.java,v 1.6 2002/05/28 18:07:41 
tmiller Exp $
  + * @(#)$Id: TransletOutputHandlerFactory.java,v 1.7 2002/05/28 19:35:26 
santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -66,11 +66,16 @@
   import java.io.IOException;
   import java.io.OutputStream;
   
  +import org.w3c.dom.Node;
   import org.xml.sax.SAXException;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.ext.LexicalHandler;
   import org.apache.xalan.xsltc.runtime.*;
  +import org.apache.xalan.xsltc.TransletException;
   import org.apache.xalan.xsltc.TransletOutputHandler;
  +import javax.xml.parsers.ParserConfigurationException;
  +
  +import org.apache.xalan.xsltc.trax.SAX2DOM;
   
   public class TransletOutputHandlerFactory {
   
  @@ -83,7 +88,8 @@
       private int    _outputType     = STREAM;
       private OutputStream _ostream  = System.out;
       private Writer _writer         = null;
  -    private ContentHandler _handler= null;
  +    private Node           _node   = null;
  +    private ContentHandler _handler    = null;
       private LexicalHandler _lexHandler = null;
   
       static public TransletOutputHandlerFactory newInstance() {
  @@ -120,7 +126,18 @@
        _lexHandler = lex;
       }
   
  -    public TransletOutputHandler getTransletOutputHandler() throws 
IOException {
  +    public void setNode(Node node) {
  +     _node = node;
  +    }
  +
  +    public Node getNode() {
  +     return (_handler instanceof SAX2DOM) ? ((SAX2DOM)_handler).getDOM() 
  +        : null;
  +    }
  +
  +    public TransletOutputHandler getTransletOutputHandler() 
  +     throws IOException, ParserConfigurationException 
  +    {
        switch (_outputType) {
            case STREAM:
                if (_method == null) {
  @@ -145,26 +162,28 @@
                        new StreamTextOutput(_writer, _encoding);
                }
            break;
  +         case DOM:
  +             _lexHandler = null;
  +             _handler = (_node != null) ? new SAX2DOM(_node) : 
  +                                          new SAX2DOM();
  +             // falls through
            case SAX:
  -                if (_method == null) {
  -                    _method = "xml";    // default case
  -                }
  +             if (_method == null) {
  +                 _method = "xml";    // default case
  +             }
   
  -                if (_method.equalsIgnoreCase("xml")) {
  -                    return (_lexHandler == null) ? 
  +             if (_method.equalsIgnoreCase("xml")) {
  +                 return (_lexHandler == null) ? 
                        new SAXXMLOutput(_handler, _encoding) :
                        new SAXXMLOutput(_handler, _lexHandler, _encoding);
  -                }
  -                else if (_method.equalsIgnoreCase("html")) {
  -                    return (_lexHandler == null) ? 
  +             }
  +             else if (_method.equalsIgnoreCase("html")) {
  +                 return (_lexHandler == null) ? 
                        new SAXHTMLOutput(_handler, _encoding) :
                        new SAXHTMLOutput(_handler, _lexHandler, _encoding);
  -                }
  -            break;
  -
  -         case DOM:
  -             // TODO
  +             }
            break;
  +
        }
        return null;
       }
  
  
  
  1.12      +2 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/trax/SAX2DOM.java
  
  Index: SAX2DOM.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/SAX2DOM.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SAX2DOM.java      24 Apr 2002 17:03:17 -0000      1.11
  +++ SAX2DOM.java      28 May 2002 19:35:26 -0000      1.12
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: SAX2DOM.java,v 1.11 2002/04/24 17:03:17 santiagopg Exp $
  + * @(#)$Id: SAX2DOM.java,v 1.12 2002/05/28 19:35:26 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -80,7 +80,7 @@
   
   import org.apache.xalan.xsltc.runtime.Constants;
   
  -class SAX2DOM implements ContentHandler, Constants {
  +public class SAX2DOM implements ContentHandler, Constants {
   
       private Document _root = null;
       private Stack _nodeStk = new Stack();
  
  
  
  1.8       +8 -3      
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java
  
  Index: TemplatesHandlerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TemplatesHandlerImpl.java 10 May 2002 13:22:33 -0000      1.7
  +++ TemplatesHandlerImpl.java 28 May 2002 19:35:26 -0000      1.8
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TemplatesHandlerImpl.java,v 1.7 2002/05/10 13:22:33 tmiller Exp $
  + * @(#)$Id: TemplatesHandlerImpl.java,v 1.8 2002/05/28 19:35:26 santiagopg 
Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -78,11 +78,15 @@
   
       private String _systemId;
   
  +    // Temporary
  +    private boolean _experimentalOutput;
  +
       /**
        * Default constructor
        */
  -    protected TemplatesHandlerImpl() {
  +    protected TemplatesHandlerImpl(boolean experimentalOutput) {
        super(null);
  +     _experimentalOutput = experimentalOutput;
       }
   
       /**
  @@ -168,7 +172,8 @@
                return null;
            }
   
  -         return(new TemplatesImpl(bytecodes, transletName));
  +         return new TemplatesImpl(bytecodes, transletName, 
  +                                  _experimentalOutput);
        }
        catch (CompilerException e) {
            return null;
  
  
  
  1.12      +9 -3      
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesImpl.java
  
  Index: TemplatesImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TemplatesImpl.java        24 Apr 2002 17:03:17 -0000      1.11
  +++ TemplatesImpl.java        28 May 2002 19:35:26 -0000      1.12
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TemplatesImpl.java,v 1.11 2002/04/24 17:03:17 santiagopg Exp $
  + * @(#)$Id: TemplatesImpl.java,v 1.12 2002/05/28 19:35:26 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -97,6 +97,9 @@
       // and _bytecodes arrays (above).
       private int _transletIndex = -1;
       
  +    // Temporary
  +    private boolean _experimentalOutput;
  +
       // Our own private class loader - builds Class definitions from bytecodes
       private class TransletClassLoader extends ClassLoader {
   
  @@ -127,9 +130,12 @@
        * The bytecodes for the translet and auxiliary classes, plus the name of
        * the main translet class, must be supplied
        */
  -    protected TemplatesImpl(byte[][] bytecodes, String transletName) {
  +    protected TemplatesImpl(byte[][] bytecodes, String transletName,
  +     boolean experimentalOutput) 
  +    {
        _bytecodes = bytecodes;
        _name      = transletName;
  +     _experimentalOutput = experimentalOutput;
       }
   
       /**
  @@ -256,7 +262,7 @@
        */
       public Transformer newTransformer()
        throws TransformerConfigurationException {
  -        return(new TransformerImpl(getTransletInstance()));
  +        return new TransformerImpl(getTransletInstance(), 
_experimentalOutput);
       }
   
       /**
  
  
  
  1.38      +10 -5     
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- TransformerFactoryImpl.java       8 May 2002 13:28:09 -0000       1.37
  +++ TransformerFactoryImpl.java       28 May 2002 19:35:27 -0000      1.38
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransformerFactoryImpl.java,v 1.37 2002/05/08 13:28:09 tmiller 
Exp $
  + * @(#)$Id: TransformerFactoryImpl.java,v 1.38 2002/05/28 19:35:27 
santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -143,7 +143,7 @@
       // This flags are passed to the compiler
       private boolean _debug = false;
       private boolean _disableInlining = false;
  -
  +    private boolean _experimentalOutput = false;
   
       /**
        * javax.xml.transform.sax.TransformerFactory implementation.
  @@ -220,6 +220,9 @@
        else if (name.equals("disable-inlining") && value instanceof Boolean) {
            _disableInlining = ((Boolean) value).booleanValue();
        }
  +     else if (name.equals("experimental-output") && value instanceof 
Boolean) {
  +         _experimentalOutput = ((Boolean) value).booleanValue();
  +     }
        else {
            // Throw an exception for all other attributes
            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
  @@ -342,7 +345,8 @@
        }
   
        // Create a Transformer object and store for other calls
  -     Templates templates = new TemplatesImpl(bytecodes,_defaultTransletName);
  +     Templates templates = new TemplatesImpl(bytecodes, _defaultTransletName,
  +                                             _experimentalOutput);
        _copyTransformer = templates.newTransformer();
        if (_uriResolver != null) _copyTransformer.setURIResolver(_uriResolver);
        return(_copyTransformer);
  @@ -523,7 +527,7 @@
            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
            throw new TransformerConfigurationException(err.toString());
        }
  -     return(new TemplatesImpl(bytecodes, transletName));
  +     return new TemplatesImpl(bytecodes, transletName, _experimentalOutput);
       }
   
       /**
  @@ -536,7 +540,8 @@
        */
       public TemplatesHandler newTemplatesHandler() 
        throws TransformerConfigurationException { 
  -     final TemplatesHandlerImpl handler = new TemplatesHandlerImpl();
  +     final TemplatesHandlerImpl handler = 
  +         new TemplatesHandlerImpl(_experimentalOutput);
        handler.init();
        return handler;
       }
  
  
  
  1.41      +180 -91   
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- TransformerImpl.java      16 May 2002 20:03:54 -0000      1.40
  +++ TransformerImpl.java      28 May 2002 19:35:27 -0000      1.41
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransformerImpl.java,v 1.40 2002/05/16 20:03:54 santiagopg Exp $
  + * @(#)$Id: TransformerImpl.java,v 1.41 2002/05/28 19:35:27 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -101,9 +101,11 @@
   
   import org.apache.xalan.xsltc.Translet;
   import org.apache.xalan.xsltc.TransletException;
  +import org.apache.xalan.xsltc.TransletOutputHandler;
   import org.apache.xalan.xsltc.DOMCache;
   import org.apache.xalan.xsltc.dom.*;
   import org.apache.xalan.xsltc.runtime.*;
  +import org.apache.xalan.xsltc.runtime.output.*;
   import org.apache.xalan.xsltc.compiler.*;
   import org.apache.xalan.xsltc.compiler.util.ErrorMsg;
   
  @@ -134,13 +136,19 @@
       private static final String NAMESPACE_FEATURE =
        "http://xml.org/sax/features/namespaces";;
       
  +    private TransletOutputHandlerFactory _tohFactory = null;
  +
  +    // Temporary
  +    private boolean _experimentalOutput;
  +
       /**
        * Implements JAXP's Transformer constructor
        * Our Transformer objects always need a translet to do the actual work
        */
  -    protected TransformerImpl(Translet translet) {
  +    protected TransformerImpl(Translet translet, boolean experimentalOutput) 
{
        _translet = (AbstractTranslet)translet;
        _properties = createOutputProperties();
  +     _experimentalOutput = experimentalOutput;
       }
   
       /**
  @@ -165,24 +173,159 @@
            throw new TransformerException(err.toString());
        }
   
  -     _handler = getOutputHandler(result);
  -     if (_handler == null) {
  -         ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_HANDLER_ERR);
  -         throw new TransformerException(err.toString());
  +     // Pass output properties to the translet
  +     setOutputProperties(_translet, _properties);
  +         
  +     if (_experimentalOutput) {
  +         final TransletOutputHandler toHandler = 
  +             getExperimentalOutputHandler(result);
  +
  +         if (toHandler == null) {
  +             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_HANDLER_ERR);
  +             throw new TransformerException(err.toString());
  +         }
  +
  +         if (_uriResolver != null) {
  +             _translet.setDOMCache(this);
  +         }
  +
  +         transform(source, toHandler, _encoding);
  +
  +         if (result instanceof DOMResult) {
  +             ((DOMResult)result).setNode(_tohFactory.getNode());
  +         }
        }
  +     else {
  +         _handler = getOutputHandler(result);
  +         if (_handler == null) {
  +             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_HANDLER_ERR);
  +             throw new TransformerException(err.toString());
  +         }
   
  -     if (_uriResolver != null) {
  -         _translet.setDOMCache(this);
  +         if (_uriResolver != null) {
  +             _translet.setDOMCache(this);
  +         }
  +
  +         // Run the transformation
  +         transform(source, (ContentHandler)_handler, _encoding);
  +
  +         // If a DOMResult, then we must set the DOM Tree so it can
  +         // be retrieved later 
  +         if (result instanceof DOMResult) {
  +             ((DOMResult)result).setNode(((SAX2DOM)_handler).getDOM());
  +         }
        }
  +    }
   
  -     // Run the transformation
  -     transform(source, (ContentHandler)_handler, _encoding);
  +    /**
  +     * Create an output handler for the transformation output based on 
  +     * the type and contents of the TrAX Result object passed to the 
  +     * transform() method. 
  +     */
  +    private TransletOutputHandler getExperimentalOutputHandler(Result 
result) 
  +     throws TransformerException 
  +    {
  +     // Try to get the encoding from the translet (may not be set)
  +     if (_translet._encoding != null) {
  +            _encoding = _translet._encoding;
  +        }
  +        else {
  +            _encoding = "UTF-8"; // default output encoding
  +        }
  +
  +     _tohFactory = TransletOutputHandlerFactory.newInstance();
  +     _tohFactory.setEncoding(_encoding);
  +
  +     // Is _method already set? TODO
  +     _tohFactory.setOutputMethod(_translet._method);
   
  -     // If a DOMResult, then we must set the DOM Tree so it can
  -     // be retrieved later 
  -     if (result instanceof DOMResult) {
  -         ((DOMResult)result).setNode(((SAX2DOM)_handler).getDOM());
  +     // Return the content handler for this Result object
  +     try {
  +         // Result object could be SAXResult, DOMResult, or StreamResult 
  +         if (result instanceof SAXResult) {
  +                final SAXResult target = (SAXResult)result;
  +                final ContentHandler handler = target.getHandler();
  +
  +             _tohFactory.setHandler(handler);
  +             if (handler instanceof LexicalHandler) {
  +                 _tohFactory.setLexicalHandler((LexicalHandler) handler);
  +             }
  +             _tohFactory.setOutputType(TransletOutputHandlerFactory.SAX);
  +             return _tohFactory.getTransletOutputHandler();
  +            }
  +         else if (result instanceof DOMResult) {
  +             _tohFactory.setNode(((DOMResult) result).getNode());
  +             _tohFactory.setOutputType(TransletOutputHandlerFactory.DOM);
  +             return _tohFactory.getTransletOutputHandler();
  +            }
  +         else if (result instanceof StreamResult) {
  +             // Get StreamResult
  +             final StreamResult target = (StreamResult) result;      
  +
  +             // StreamResult may have been created with a java.io.File,
  +             // java.io.Writer, java.io.OutputStream or just a String
  +             // systemId. 
  +
  +             _tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
  +
  +             // try to get a Writer from Result object
  +             final Writer writer = target.getWriter();
  +             if (writer != null) {
  +                 _tohFactory.setWriter(writer);
  +                 return _tohFactory.getTransletOutputHandler();
  +             }
  +
  +             // or try to get an OutputStream from Result object
  +             final OutputStream ostream = target.getOutputStream();
  +             if (ostream != null) {
  +                 _tohFactory.setOutputStream(ostream);
  +                 return _tohFactory.getTransletOutputHandler();
  +             }
  +
  +             // or try to get just a systemId string from Result object
  +             String systemId = result.getSystemId();
  +             if (systemId == null) {
  +                 ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR);
  +                    throw new TransformerException(err.toString());
  +             }
  +
  +             // System Id may be in one of several forms, (1) a uri
  +             // that starts with 'file:', (2) uri that starts with 'http:'
  +             // or (3) just a filename on the local system.
  +             URL url = null;
  +             if (systemId.startsWith("file:")) {
  +                    url = new URL(systemId);
  +                 _tohFactory.setOutputStream(
  +                     new FileOutputStream(url.getFile()));
  +                 return _tohFactory.getTransletOutputHandler();
  +                }
  +                else if (systemId.startsWith("http:")) {
  +                    url = new URL(systemId);
  +                    final URLConnection connection = url.openConnection();
  +                 _tohFactory.setOutputStream(connection.getOutputStream());
  +                 return _tohFactory.getTransletOutputHandler();
  +                }
  +                else {
  +                    // system id is just a filename
  +                    url = new File(systemId).toURL();
  +                 _tohFactory.setOutputStream(
  +                     new FileOutputStream(url.getFile()));
  +                 return _tohFactory.getTransletOutputHandler();
  +                }
  +         }
        }
  +        // If we cannot write to the location specified by the SystemId
  +        catch (UnknownServiceException e) {
  +            throw new TransformerException(e);
  +        }
  +        catch (ParserConfigurationException e) {
  +            throw new TransformerException(e);
  +        }
  +        // If we cannot create the file specified by the SystemId
  +        catch (IOException e) {
  +            throw new TransformerException(e);
  +        }
  +     return null;
       }
   
       /**
  @@ -281,80 +424,6 @@
        return null;
       }
   
  -
  -/*************
  -    private ContentHandler getOutputHandler(Result result) 
  -     throws TransformerException {
  -     // Try to get the encoding from Translet (may not be set)
  -     if (_translet._encoding != null) {
  -         _encoding = _translet._encoding;
  -     }
  -     else {
  -         _encoding = "UTF-8"; // default output encoding
  -     }
  -
  -     try {
  -         String systemId = result.getSystemId();
  -
  -         // Handle SAXResult output handler
  -         if (result instanceof SAXResult) {
  -             final SAXResult target = (SAXResult)result;
  -             final ContentHandler handler = target.getHandler();
  -             // Simple as feck, just pass the SAX handler back...
  -             if (handler != null) return handler;
  -         }
  -         // Handle StreamResult output handler
  -         else if (result instanceof StreamResult) {
  -             final StreamResult target = (StreamResult)result;
  -             final OutputStream ostream = target.getOutputStream();
  -             final Writer writer = target.getWriter();
  -
  -             if (ostream != null)
  -                 return (new DefaultSAXOutputHandler(ostream, _encoding));
  -             else if (writer != null)
  -                 return (new DefaultSAXOutputHandler(writer, _encoding));
  -             else if ((systemId != null) && systemId.startsWith("file:")) {
  -                 final URL url = new URL(systemId);
  -                 final OutputStream os = new FileOutputStream(url.getFile());
  -                 return (new DefaultSAXOutputHandler(os, _encoding));
  -             }
  -         }
  -         // Handle DOMResult output handler
  -         else if (result instanceof DOMResult) {
  -             return (new SAX2DOM());
  -         }
  -
  -         // Common, final handling of all input sources, only used if the
  -         // other contents of the Result object could not be used
  -         if (systemId != null) {
  -             if ((new File(systemId)).exists()) systemId = "file:"+systemId;
  -             final URL url = new URL(systemId);
  -             final URLConnection connection = url.openConnection();
  -             final OutputStream ostream = connection.getOutputStream();
  -             return(new DefaultSAXOutputHandler(ostream, _encoding));
  -         }
  -         else {
  -             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR);
  -             throw new TransformerException(err.toString());
  -         }
  -     }
  -     // If we cannot write to the location specified by the SystemId
  -     catch (UnknownServiceException e) {
  -         throw new TransformerException(e);
  -     }
  -     // If we cannot create a SAX2DOM adapter
  -     catch (ParserConfigurationException e) {
  -         ErrorMsg err = new ErrorMsg(ErrorMsg.SAX2DOM_ADAPTER_ERR);
  -         throw new TransformerException(err.toString());
  -     }
  -     // If we cannot create the file specified by the SystemId
  -     catch (IOException e) {
  -         throw new TransformerException(e);
  -     }
  -    }
  -
  -**********************/
  -
       /**
        * Set the internal DOMImpl that will be used for the next transformation
        */
  @@ -539,15 +608,35 @@
       /**
        * Internal transformation method - uses the internal APIs of XSLTC
        */
  +    private void transform(Source src, TransletOutputHandler handler, 
  +     String encoding) throws TransformerException 
  +    {
  +     try {
  +         _translet.transform(getDOM(src, 0), handler);
  +     }
  +     catch (TransletException e) {
  +         if (_errorListener != null) postErrorToListener(e.getMessage());
  +         throw new TransformerException(e);
  +     }
  +     catch (RuntimeException e) {
  +         if (_errorListener != null) postErrorToListener(e.getMessage());
  +         throw new TransformerException(e);
  +     }
  +     catch (Exception e) {
  +         if (_errorListener != null) postErrorToListener(e.getMessage());
  +         throw new TransformerException(e);
  +     }
  +    }
  +
  +    /**
  +     * Internal transformation method - uses the internal APIs of XSLTC
  +     */
       private void transform(Source src, ContentHandler sax, String encoding)
        throws TransformerException {
        try {
            // Build an iternal DOMImpl from the TrAX Source
            DOMImpl dom = getDOM(src, 0);
   
  -         // Pass output properties to the translet
  -         setOutputProperties(_translet, _properties);
  -         
            // This handler will post-process the translet output
            TextOutput handler;
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to