cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/transformation TraxTransformer.java
Date Wed, 23 May 2001 08:57:28 GMT
cziegeler    01/05/23 01:57:28

  Modified:    src/org/apache/cocoon/environment AbstractEnvironment.java
                        SourceResolver.java
               src/org/apache/cocoon/transformation TraxTransformer.java
  Log:
  The environment is now independant of the trax package. The TraxTransformer is the URIResolver
for the stylesheets
  
  Revision  Changes    Path
  1.3       +0 -26     xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractEnvironment.java	2001/05/22 14:38:35	1.2
  +++ AbstractEnvironment.java	2001/05/23 08:57:26	1.3
  @@ -191,32 +191,6 @@
       }
   
       /**
  -     * Called by the processor when it encounters
  -     * an xsl:include, xsl:import, or document() function.
  -     *
  -     * @param href An href attribute, which may be relative or absolute.
  -     * @param base The base URI in effect when the href attribute
  -     * was encountered.
  -     *
  -     * @return A Source object, or null if the href cannot be resolved,
  -     * and the processor should try to resolve the URI itself.
  -     *
  -     * @throws TransformerException if an error occurs when trying to
  -     * resolve the URI.
  -     */
  -    public javax.xml.transform.Source resolve(String href, String base)
  -    throws javax.xml.transform.TransformerException {
  -        try {
  -            return new javax.xml.transform.stream.StreamSource(this.resolve(href).getReader());
  -        } catch (IOException e) {
  -            throw new javax.xml.transform.TransformerException(e);
  -        } catch (SAXException e) {
  -            throw new javax.xml.transform.TransformerException(e);
  -        }
  -    }
  -
  -
  -    /**
        * Push a new URI for processing
        */
       public void pushURI(String uri) {
  
  
  
  1.2       +3 -6      xml-cocoon2/src/org/apache/cocoon/environment/SourceResolver.java
  
  Index: SourceResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/SourceResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SourceResolver.java	2001/05/22 14:38:52	1.1
  +++ SourceResolver.java	2001/05/23 08:57:26	1.2
  @@ -9,19 +9,16 @@
   package org.apache.cocoon.environment;
   
   import java.io.IOException;
  -import javax.xml.transform.URIResolver;
   import org.xml.sax.SAXException;
   
   /**
  - * Base interface for resolving a source by system identifiers. This
  - * interface extends the <code>URIResolver</code> interface.
  + * Base interface for resolving a source by system identifiers.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/05/22 14:38:52 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/05/23 08:57:26 $
    */
   
  -public interface SourceResolver
  -extends URIResolver {
  +public interface SourceResolver {
   
       /**
        * Resolve the source.
  
  
  
  1.4       +30 -4     xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TraxTransformer.java	2001/05/22 14:47:46	1.3
  +++ TraxTransformer.java	2001/05/23 08:57:27	1.4
  @@ -20,6 +20,7 @@
   import javax.xml.transform.Templates;
   import javax.xml.transform.TransformerConfigurationException;
   import javax.xml.transform.TransformerFactory;
  +import javax.xml.transform.URIResolver;
   import javax.xml.transform.sax.SAXResult;
   import javax.xml.transform.sax.SAXSource;
   import javax.xml.transform.sax.SAXTransformerFactory;
  @@ -99,10 +100,10 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version CVS $Id: TraxTransformer.java,v 1.3 2001/05/22 14:47:46 cziegeler Exp $
  + * @version CVS $Id: TraxTransformer.java,v 1.4 2001/05/23 08:57:27 cziegeler Exp $
    */
   public class TraxTransformer extends ContentHandlerWrapper
  -implements Transformer, Composable, Recyclable, Configurable, Cacheable, Disposable {
  +implements Transformer, Composable, Recyclable, Configurable, Cacheable, Disposable, URIResolver
{
   
       private static final String FILE = "file:";
   
  @@ -215,9 +216,8 @@
           if(tfactory == null)  {
               tfactory = (SAXTransformerFactory) TransformerFactory.newInstance();
               tfactory.setErrorListener(new TraxErrorHandler(getLogger()));
  -            tfactory.setURIResolver((javax.xml.transform.URIResolver)this.resolver);
  +            tfactory.setURIResolver(this);
           }
  -        tfactory.setURIResolver((javax.xml.transform.URIResolver)this.resolver);
           return tfactory;
       }
   
  @@ -511,4 +511,30 @@
           this.resolver = null;
           super.recycle();
       }
  +
  +    /**
  +     * Called by the processor when it encounters
  +     * an xsl:include, xsl:import, or document() function.
  +     *
  +     * @param href An href attribute, which may be relative or absolute.
  +     * @param base The base URI in effect when the href attribute
  +     * was encountered.
  +     *
  +     * @return A Source object, or null if the href cannot be resolved,
  +     * and the processor should try to resolve the URI itself.
  +     *
  +     * @throws TransformerException if an error occurs when trying to
  +     * resolve the URI.
  +     */
  +    public javax.xml.transform.Source resolve(String href, String base)
  +    throws javax.xml.transform.TransformerException {
  +        try {
  +            return new javax.xml.transform.stream.StreamSource(this.resolver.resolve(href).getReader());
  +        } catch (IOException e) {
  +            throw new javax.xml.transform.TransformerException(e);
  +        } catch (SAXException e) {
  +            throw new javax.xml.transform.TransformerException(e);
  +        }
  +    }
  +
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message