dleslie     00/02/24 14:14:38

  Modified:    src/org/apache/xalan/xslt/extensions Redirect.java
  Log:
  javadoc cleanup
  
  Revision  Changes    Path
  1.8       +60 -64    
xml-xalan/src/org/apache/xalan/xslt/extensions/Redirect.java
  
  Index: Redirect.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xslt/extensions/Redirect.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Redirect.java     2000/02/21 08:14:30     1.7
  +++ Redirect.java     2000/02/24 22:14:37     1.8
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -18,15 +18,15 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
    *
  - * 4. The names "XSLT4J" and "Apache Software Foundation" must
  + * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact [EMAIL PROTECTED]
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -72,34 +72,32 @@
   import org.xml.sax.DocumentHandler;
   
   /**
  - * This element extension class allows an XSLT transformation to 
  - * redirect it's output to multiple documents, or FormatterListeners.
  - * You must declare the XSLT4J namespace 
(xmlns:lxslt="http://xml.apache.org/xslt";),
  - * a namespace for the extension prefix (try 
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect")
  + * Implements three extension elements to allow an XSLT transformation to
  + * redirect its output to multiple output files.
  + * You must declare the Xalan namespace 
(xmlns:lxslt="http://xml.apache.org/xslt";),
  + * a namespace for the extension prefix (such as 
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"),
    * and declare the extension namespace as an extension 
(extension-element-prefixes="redirect").
  - * You can either just use redirect:write, in which case the file will be 
  - * opened and immediately closed after the write, or you can bracket the 
  - * write calls by redirect:open and redirect:close, in which case the 
  - * file will be kept open for multiple writes until the close call is 
  - * encountered.  Calls can be nested.  Calls can take a 'file' attribute 
  - * and/or a 'select' attribute in order to get the filename.  If a select 
  - * attribute is encountered, it will evaluate that expression for a string 
  - * that indicates the filename.  If the string evaluates to empty, it will 
  - * attempt to use the 'file' attribute as a default.  Filenames can be 
relative 
  - * or absolute.  If they are relative, the base directory will be the same 
as 
  - * the base directory for the output document 
(setOutputFileName(outFileName) must 
  - * be called first on the processor when using the API).  Currently this 
extension 
  - * can only be used when the current formatter listener is one of 
FormatterToHTML,
  - * FormatterToXML, or FormatterToText.<BR><BR>
  - * 
  - * Example:
  + * You can either just use redirect:write, in which case the file will be
  + * opened and immediately closed after the write, or you can bracket the
  + * write calls by redirect:open and redirect:close, in which case the
  + * file will be kept open for multiple writes until the close call is
  + * encountered.  Calls can be nested.  Calls can take a 'file' attribute
  + * and/or a 'select' attribute in order to get the filename.  If a select
  + * attribute is encountered, it will evaluate that expression for a string
  + * that indicates the filename.  If the string evaluates to empty, it will
  + * attempt to use the 'file' attribute as a default.  Filenames can be 
relative
  + * or absolute.  If they are relative, the base directory will be the same as
  + * the base directory for the output document 
(setOutputFileName(outFileName) must
  + * be called first on the processor when using the API).
  + *
  + * <p>Example:</p>
    * <PRE>
    * &lt;?xml version="1.0"?>
    * &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
    *                 xmlns:lxslt="http://xml.apache.org/xslt";
    *                 xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
    *                 extension-element-prefixes="redirect">
  - * 
  + *
    *   &lt;xsl:template match="/">
    *     &lt;out>
    *       default output.
  @@ -130,13 +128,13 @@
    *     &lt;/redirect:write>
    *     &lt;redirect:close file="doc3.out"/>
    *   &lt;/xsl:template>
  - *  
  + *
    * &lt;/xsl:stylesheet>
    * </PRE>
  - * 
  + *
    * @author Scott Boag
    * @version 1.0
  - * @see extensions.html
  + * @see <a href="../../../../../../extensions.html#ex-redirect" 
target="_top">Example with Redirect extension</a>
    */
   public class Redirect
   {
  @@ -151,11 +149,11 @@
     protected Hashtable m_outputStreams = new Hashtable ();
   
     /**
  -   * Open the given file and put it in the formatter listeners table.
  +   * Open the given file and put it in the XML, HTML, or Text formatter 
listener's table.
      */
  -  public void open(XSLProcessorContext context, Element elem) 
  -    throws java.net.MalformedURLException, 
  -           java.io.FileNotFoundException, 
  +  public void open(XSLProcessorContext context, Element elem)
  +    throws java.net.MalformedURLException,
  +           java.io.FileNotFoundException,
              java.io.IOException,
              org.xml.sax.SAXException
     {
  @@ -164,7 +162,7 @@
       if(null == flistener)
       {
         String mkdirsExpr = ((ElemExtensionCall)elem).getAttribute ("mkdirs", 
context.sourceNode, context.processor);
  -      boolean mkdirs = (mkdirsExpr != null) 
  +      boolean mkdirs = (mkdirsExpr != null)
                          ? (mkdirsExpr.equals("true") || 
mkdirsExpr.equals("yes")) : true;
         DocumentHandler fl = makeFormatterListener(context, fileName, true, 
mkdirs);
         // fl.startDocument();
  @@ -172,13 +170,12 @@
     }
   
     /**
  -   * Write the evalutation of the element children to the given 
  -   * file.  If the filename is in the formatter listeners table, 
  -   * don't close the file after the write, otherwise close it.
  +   * Write the evalutation of the element children to the given file. Then 
close the file
  +   * unless it was opened with the open extension element and is in the 
formatter listener's table.
      */
  -  public void write(XSLProcessorContext context, Element elem) 
  -    throws java.net.MalformedURLException, 
  -           java.io.FileNotFoundException, 
  +  public void write(XSLProcessorContext context, Element elem)
  +    throws java.net.MalformedURLException,
  +           java.io.FileNotFoundException,
              java.io.IOException,
              org.xml.sax.SAXException
     {
  @@ -189,7 +186,7 @@
       if(null == flObject)
       {
         String mkdirsExpr = ((ElemExtensionCall)elem).getAttribute ("mkdirs", 
context.sourceNode, context.processor);
  -      boolean mkdirs = (mkdirsExpr != null) 
  +      boolean mkdirs = (mkdirsExpr != null)
                          ? (mkdirsExpr.equals("true") || 
mkdirsExpr.equals("yes")) : true;
         formatter = makeFormatterListener(context, fileName, true, mkdirs);
       }
  @@ -198,9 +195,9 @@
         inTable = true;
         formatter = (DocumentHandler)flObject;
       }
  -    
  -    context.processor.writeChildren( formatter, context.stylesheetTree, 
  -                                     (ElemTemplateElement)elem, 
  +
  +    context.processor.writeChildren( formatter, context.stylesheetTree,
  +                                     (ElemTemplateElement)elem,
                                        context.sourceTree, context.sourceNode, 
context.mode);
       if(!inTable)
       {
  @@ -214,15 +211,14 @@
         }
       }
     }
  -  
  +
   
     /**
  -   * Close the given file.  If the filename is in the formatter listeners 
table, 
  -   * close the file and remove it from the table.  Otherwise do nothing.
  +   * Close the given file and remove it from the formatter listener's table.
      */
  -  public void close(XSLProcessorContext context, Element elem) 
  -    throws java.net.MalformedURLException, 
  -    java.io.FileNotFoundException, 
  +  public void close(XSLProcessorContext context, Element elem)
  +    throws java.net.MalformedURLException,
  +    java.io.FileNotFoundException,
       java.io.IOException,
       org.xml.sax.SAXException
     {
  @@ -241,13 +237,13 @@
         m_formatterListeners.remove(fileName);
       }
     }
  -  
  +
     /**
  -   * Get the filename from either the 'select' or the 'file' attribute.
  +   * Get the filename from the 'select' or the 'file' attribute.
      */
     private String getFilename(XSLProcessorContext context, Element elem)
  -    throws java.net.MalformedURLException, 
  -    java.io.FileNotFoundException, 
  +    throws java.net.MalformedURLException,
  +    java.io.FileNotFoundException,
       java.io.IOException,
       org.xml.sax.SAXException
     {
  @@ -271,21 +267,21 @@
       }
       if(null == fileName)
       {
  -      context.processor.error(elem, context.sourceNode, 
XSLTErrorResources.ER_REDIRECT_COULDNT_GET_FILENAME); 
  +      context.processor.error(elem, context.sourceNode, 
XSLTErrorResources.ER_REDIRECT_COULDNT_GET_FILENAME);
                                 //"Redirect extension: Could not get filename 
- file or select attribute must return vald string.");
       }
       return fileName;
     }
  -  
  +
     /**
      * Create a new DocumentHandler, based on attributes of the current 
DocumentHandler.
      */
  -  private DocumentHandler makeFormatterListener(XSLProcessorContext context, 
  +  private DocumentHandler makeFormatterListener(XSLProcessorContext context,
                                                   String fileName,
                                                   boolean shouldPutInTable,
                                                   boolean mkdirs)
  -    throws java.net.MalformedURLException, 
  -    java.io.FileNotFoundException, 
  +    throws java.net.MalformedURLException,
  +    java.io.FileNotFoundException,
       java.io.IOException,
       org.xml.sax.SAXException
     {
  @@ -308,15 +304,15 @@
           dir.mkdirs();
         }
       }
  -    
  +
       StylesheetRoot sr = context.stylesheetTree.m_stylesheetRoot;
       OutputFormat formatter = sr.getOutputFormat();
  -    
  +
       FileOutputStream ostream = new FileOutputStream(file);
  -    
  -    DocumentHandler flistener 
  +
  +    DocumentHandler flistener
         = sr.makeSAXSerializer(ostream, formatter);
  -    
  +
       flistener.startDocument();
       if(shouldPutInTable)
       {
  
  
  

Reply via email to