You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mi...@apache.org on 2004/03/04 21:42:42 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/processor ProcessorInclude.java ProcessorLRE.java XSLTElementDef.java ProcessorStylesheetElement.java ProcessorImport.java StylesheetHandler.java

minchau     2004/03/04 12:42:42

  Modified:    java/src/org/apache/xalan/processor ProcessorInclude.java
                        ProcessorLRE.java XSLTElementDef.java
                        ProcessorStylesheetElement.java
                        ProcessorImport.java StylesheetHandler.java
  Log:
  Submitted by:	Brian Minchau
  Modified code for potential extension of classes with callbacks to the extensions.
  
  Revision  Changes    Path
  1.28      +19 -2     xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java
  
  Index: ProcessorInclude.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ProcessorInclude.java	11 Feb 2004 18:15:51 -0000	1.27
  +++ ProcessorInclude.java	4 Mar 2004 20:42:41 -0000	1.28
  @@ -43,8 +43,10 @@
    * TransformerFactory class for xsl:include markup.
    * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
    * @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT Specification</a>
  + * 
  + * @xsl.usage internal
    */
  -class ProcessorInclude extends XSLTElementProcessor
  +public class ProcessorInclude extends XSLTElementProcessor
   {
   
     /**
  @@ -223,6 +225,9 @@
           source = new StreamSource(absURL);
         }
         
  +      // possible callback to a class that over-rides this method.
  +      source = processSource(handler, source);
  +      
         XMLReader reader = null;
         
         if(source instanceof SAXSource)
  @@ -281,5 +286,17 @@
       {
         handler.error(te.getMessage(), te);
       }
  +  }
  +
  +  /**
  +   * This method does nothing, but a class that extends this class could
  +   * over-ride it and do some processing of the source.
  +   * @param handler The calling StylesheetHandler/TemplatesBuilder.
  +   * @param source The source of the included stylesheet.
  +   * @return the same or an equivalent source to what was passed in.
  +   */
  +  protected Source processSource(StylesheetHandler handler, Source source)
  +  {
  +      return source;
     }
   }
  
  
  
  1.25      +15 -2     xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java
  
  Index: ProcessorLRE.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ProcessorLRE.java	11 Feb 2004 18:15:51 -0000	1.24
  +++ ProcessorLRE.java	4 Mar 2004 20:42:41 -0000	1.25
  @@ -88,7 +88,7 @@
           Stylesheet stylesheet;
           try
           {
  -          stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener());
  +          stylesheet = getStylesheetRoot(handler);
           }
           catch(TransformerConfigurationException tfe)
           {
  @@ -308,6 +308,19 @@
     }
   
     /**
  +   * This method could be over-ridden by a class that extends this class.
  +   * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
  +   * @return an object that represents the stylesheet element.
  +   */
  +  protected Stylesheet getStylesheetRoot(StylesheetHandler handler) throws TransformerConfigurationException
  +  {
  +    Stylesheet stylesheet;
  +    stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener());
  +    return stylesheet;
  +  }
  +  
  +
  +/**
      * Receive notification of the end of an element.
      *
      * @param name The element type name.
  
  
  
  1.19      +7 -4      xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java
  
  Index: XSLTElementDef.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XSLTElementDef.java	11 Feb 2004 18:15:50 -0000	1.18
  +++ XSLTElementDef.java	4 Mar 2004 20:42:41 -0000	1.19
  @@ -414,8 +414,9 @@
      * Get the allowed elements for this type.
      *
      * @return An array of allowed child element defs, or null.
  +   * @xsl.usage internal
      */
  -  XSLTElementDef[] getElements()
  +  public XSLTElementDef[] getElements()
     {
       return m_elements;
     }
  @@ -622,8 +623,9 @@
      * Return the XSLTElementProcessor for this element.
      *
      * @return The element processor for this element.
  +   * @xsl.usage internal
      */
  -  XSLTElementProcessor getElementProcessor()
  +  public XSLTElementProcessor getElementProcessor()
     {
       return m_elementProcessor;
     }
  @@ -632,8 +634,9 @@
      * Set the XSLTElementProcessor for this element.
      *
      * @param handler The element processor for this element.
  +   * @xsl.usage internal
      */
  -  void setElementProcessor(XSLTElementProcessor handler)
  +  public void setElementProcessor(XSLTElementProcessor handler)
     {
   
       if (handler != null)
  
  
  
  1.14      +16 -3     xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetElement.java
  
  Index: ProcessorStylesheetElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetElement.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ProcessorStylesheetElement.java	11 Feb 2004 18:15:51 -0000	1.13
  +++ ProcessorStylesheetElement.java	4 Mar 2004 20:42:41 -0000	1.14
  @@ -31,8 +31,10 @@
    * TransformerFactory for xsl:stylesheet or xsl:transform markup.
    * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
    * @see <a href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT Specification</a>
  + * 
  + * @xsl.usage internal
    */
  -class ProcessorStylesheetElement extends XSLTElementProcessor
  +public class ProcessorStylesheetElement extends XSLTElementProcessor
   {
   
     /**
  @@ -66,7 +68,7 @@
         {
           try
           {
  -          stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener());
  +          stylesheet = getStylesheetRoot(handler);
           }
           catch(TransformerConfigurationException tfe)
           {
  @@ -109,6 +111,17 @@
     }
   
     /**
  +   * This method can be over-ridden by a class that extends this one.
  +   * @param handler The calling StylesheetHandler/TemplatesBuilder.
  +   */
  +  protected Stylesheet getStylesheetRoot(StylesheetHandler handler) throws TransformerConfigurationException
  +  {
  +    Stylesheet stylesheet;
  +    stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener());
  +    return stylesheet;
  +  }
  +
  +/**
      * Receive notification of the end of an element.
      *
      * @param name The element type name.
  
  
  
  1.15      +4 -2      xml-xalan/java/src/org/apache/xalan/processor/ProcessorImport.java
  
  Index: ProcessorImport.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorImport.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ProcessorImport.java	11 Feb 2004 18:15:50 -0000	1.14
  +++ ProcessorImport.java	4 Mar 2004 20:42:41 -0000	1.15
  @@ -24,8 +24,10 @@
    * This class processes parse events for an xsl:import element.
    * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
    * @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>
  + * 
  + * @xsl.usage internal
    */
  -class ProcessorImport extends ProcessorInclude
  +public class ProcessorImport extends ProcessorInclude
   {
   
     /**
  
  
  
  1.65      +10 -6     xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java
  
  Index: StylesheetHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- StylesheetHandler.java	17 Feb 2004 22:10:49 -0000	1.64
  +++ StylesheetHandler.java	4 Mar 2004 20:42:41 -0000	1.65
  @@ -1086,7 +1086,7 @@
      *
      * @return The TransformerFactoryImpl that owns this handler.
      */
  -  TransformerFactoryImpl getStylesheetProcessor()
  +  public TransformerFactoryImpl getStylesheetProcessor()
     {
       return m_stylesheetProcessor;
     }
  @@ -1094,20 +1094,23 @@
     /**
      * If {@link #getStylesheetType} returns this value, the current stylesheet
      *  is a root stylesheet.
  +   * @xsl.usage internal
      */
  -  static final int STYPE_ROOT = 1;
  +  public static final int STYPE_ROOT = 1;
   
     /**
      * If {@link #getStylesheetType} returns this value, the current stylesheet
      *  is an included stylesheet.
  +   * @xsl.usage internal
      */
  -  static final int STYPE_INCLUDE = 2;
  +  public static final int STYPE_INCLUDE = 2;
   
     /**
      * If {@link #getStylesheetType} returns this value, the current stylesheet
      *  is an imported stylesheet.
  +   * @xsl.usage internal
      */
  -  static final int STYPE_IMPORT = 3;
  +  public static final int STYPE_IMPORT = 3;
   
     /** The current stylesheet type. */
     private int m_stylesheetType = STYPE_ROOT;
  @@ -1263,8 +1266,9 @@
      * transition content handlers, create elements, etc.
      *
      * @return The root XSLT Schema, which should never be null.
  +   * @xsl.usage internal
      */
  -  XSLTSchema getSchema()
  +  public XSLTSchema getSchema()
     {
       return m_schema;
     }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org