jstrachan    02/05/16 11:20:36

  Modified:    jelly/src/test/org/apache/commons/jelly TestAll.java
                        TestCoreTags.java
               jelly    build.xml
               jelly/src/java/org/apache/commons/jelly/tags/core
                        ExprTag.java IfTag.java
               jelly/src/java/org/apache/commons/jelly jelly.properties
               jelly/src/java/org/apache/commons/jelly/tags/xml SetTag.java
                        ParseTag.java ForEachTag.java ExprTag.java
                        XMLTagLibrary.java
  Removed:     jelly/src/test/org/apache/commons/jelly example.jelly
                        TestXMLTags.java
  Log:
  Improved the JSTL support of the XML tags
  
  Also added some ObjectBridge tags for working with persistent beans and loading OJB 
based data stores.
  
  Started to add some Jelly-based unit testing. Though some assert and assertEquals 
tags should be useful.
  
  Revision  Changes    Path
  1.4       +7 -6      
jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestAll.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestAll.java      25 Apr 2002 18:58:47 -0000      1.3
  +++ TestAll.java      16 May 2002 18:20:35 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestAll.java,v
 1.3 2002/04/25 18:58:47 jstrachan Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/04/25 18:58:47 $
  + * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestAll.java,v
 1.4 2002/05/16 18:20:35 jstrachan Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/16 18:20:35 $
    *
    * ====================================================================
    *
  @@ -57,7 +57,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    * 
  - * $Id: TestAll.java,v 1.3 2002/04/25 18:58:47 jstrachan Exp $
  + * $Id: TestAll.java,v 1.4 2002/05/16 18:20:35 jstrachan Exp $
    */
   package org.apache.commons.jelly;
   
  @@ -68,11 +68,12 @@
   
   import org.apache.commons.jelly.beanshell.TestBeanShellEL;
   import org.apache.commons.jelly.define.TestDynamicTags;
  +import org.apache.commons.jelly.xml.TestXMLTags;
   
   /** Entry point for all JUnit tests.
     *
     * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  -  * @version $Revision: 1.3 $
  +  * @version $Revision: 1.4 $
    */
   public class TestAll extends TestCase {
       
  @@ -82,10 +83,10 @@
       
       public static Test suite() {
           TestSuite suite = new TestSuite();
  -        suite.addTest(TestXMLTags.suite());
           suite.addTest(TestCoreTags.suite());
           suite.addTest(TestBeanShellEL.suite());
           suite.addTest(TestDynamicTags.suite());
  +        suite.addTest(TestXMLTags.suite());
           return suite;
       }
       
  
  
  
  1.5       +1 -132    
jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestCoreTags.java
  
  Index: TestCoreTags.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestCoreTags.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestCoreTags.java 15 May 2002 06:25:49 -0000      1.4
  +++ TestCoreTags.java 16 May 2002 18:20:35 -0000      1.5
  @@ -1,132 +1 @@
  -/*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestCoreTags.java,v
 1.4 2002/05/15 06:25:49 jstrachan Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/05/15 06:25:49 $
  - *
  - * ====================================================================
  - *
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    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
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - * 
  - * $Id: TestCoreTags.java,v 1.4 2002/05/15 06:25:49 jstrachan Exp $
  - */
  -package org.apache.commons.jelly;
  -
  -import java.io.InputStream;
  -import java.io.IOException;
  -import java.io.StringWriter;
  -
  -import junit.framework.Test;
  -import junit.framework.TestCase;
  -import junit.framework.TestSuite;
  -import junit.textui.TestRunner;
  -
  -import org.apache.commons.jelly.JellyContext;
  -import org.apache.commons.jelly.Script;
  -import org.apache.commons.jelly.XMLOutput;
  -import org.apache.commons.jelly.impl.TagScript;
  -import org.apache.commons.jelly.parser.XMLParser;
  -
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -
  -
  -/** Tests the core tags
  -  *
  -  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  -  * @version $Revision: 1.4 $
  -  */
  -public class TestCoreTags extends TestCase {
  -    
  -    /** The Log to which logging calls will be made. */
  -    private static final Log log = LogFactory.getLog( TestXMLTags.class );
  -
  -    public static void main( String[] args ) {
  -        TestRunner.run( suite() );
  -    }
  -    
  -    public static Test suite() {
  -        return new TestSuite(TestCoreTags.class);
  -    }
  -    
  -    public TestCoreTags(String testName) {
  -        super(testName);
  -    }
  -    
  -    public void testArgs() throws Exception {
  -        InputStream in = getClass().getResourceAsStream( "testing123.jelly" );
  -        XMLParser parser = new XMLParser();
  -        Script script = parser.parse( in );
  -        script = script.compile();
  -
  -        log.debug( "Found: " + script );
  -        
  -        assertTrue( "Script is a TagScript", script instanceof TagScript );
  -        
  -        String[] args = { "one", "two", "three" };
  -        JellyContext context = new JellyContext();        
  -        context.setVariable( "args", args );
  -        StringWriter buffer = new StringWriter();
  -        
  -        script.run( context, XMLOutput.createXMLOutput( buffer ) );
  -        
  -        String text = buffer.toString().trim();
  -        
  -        if ( log.isDebugEnabled() ) {
  -            log.debug( "Evaluated script as..." );
  -            log.debug( text );
  -        }
  -        
  -        assertEquals( "Produces the correct output", "one two three", text );       
 
  -    }    
  -}
  -
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/TestCoreTags.java,v
 1.5 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.5 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: TestCoreTags.java,v 
1.5 2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly;

import 
java.io.InputStream;
import java.io.IOException;
import java.io.StringWriter;

import 
junit.framework.Test;
import junit.framework.TestCase;
import 
junit.framework.TestSuite;
import junit.textui.TestRunner;

import 
org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.Script;
import 
org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.impl.TagScript;
import org.apache.commons.jelly.parser.XMLParser;

import 
org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/** 
Tests the core tags
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>James 
Strachan</a>
  * @version $Revision: 1.5 $
  */
public class TestCoreTags extends 
TestCase {

    /** The Log to which logging calls will be made. */
    private static 
final Log log = LogFactory.getLog(TestCoreTags.class);

    public static void 
main(String[] args) {
        TestRunner.run(suite());
    }

    public static Test 
suite() {
        return new TestSuite(TestCoreTags.class);
    }

    public 
TestCoreTags(String testName) {
        super(testName);
    }

    public void 
testArgs() throws Exception {
        InputStream in = 
getClass().getResourceAsStream("testing123.jelly");
        XMLParser parser = new 
XMLParser();
        Script script = parser.parse(in);
        script = 
script.compile();
        log.debug("Found: " + script);
        assertTrue("Script is 
a TagScript", script instanceof TagScript);
        String[] args = { "one", "two", 
"three" };
        JellyContext context = new JellyContext();
        
context.setVariable("args", args);
        StringWriter buffer = new StringWriter();
  
      script.run(context, XMLOutput.createXMLOutput(buffer));
        String text = 
buffer.toString().trim();
        if (log.isDebugEnabled()) {
            
log.debug("Evaluated script as...");
            log.debug(text);
        }
        
assertEquals("Produces the correct output", "one two three", text);
    }
}
  \ No newline at end of file
  
  
  
  1.17      +9 -21     jakarta-commons-sandbox/jelly/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/build.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- build.xml 15 May 2002 06:25:49 -0000      1.16
  +++ build.xml 16 May 2002 18:20:35 -0000      1.17
  @@ -3,7 +3,7 @@
   
   <!--
           "Jelly" component of the Jakarta Commons Subproject
  -        $Id: build.xml,v 1.16 2002/05/15 06:25:49 jstrachan Exp $
  +        $Id: build.xml,v 1.17 2002/05/16 18:20:35 jstrachan Exp $
   -->
   
   
  @@ -22,8 +22,7 @@
     <property name="jaxp.home"               value="/usr/local/jaxp1.1"/>
     <property name="jdk.home"                value="/usr/local/jdk1.3"/>
     <property name="junit.home"              value="/usr/local/junit3.7"/>
  -  <property name="bsf.home"                value="/usr/local/bsf"/>
  -  <property name="commons.home"            value="../../jakarta-commons"/>
  +  <property name="bsf.home"                value="/usr/local/bsf"/>

  <property 
name="commons.home"            value="../../jakarta-commons"/>
     <property name="sandbox.home"            value=".."/>
     <property name="beanutils.home"          value="${commons.home}/beanutils"/>
     <property name="collections.home"        value="${commons.home}/collections"/>
  @@ -52,8 +51,7 @@
     <property name="commons-digester.api"    value="${digester.home}/dist/docs/api"/>
     <property name="commons-digester.jar"    
value="${digester.home}/dist/commons-digester.jar"/>
     <property name="commons-jexl.jar"        
value="${jexl.home}/dist/commons-jexl.jar"/>
  -  <property name="velocity-dep.jar"        
value="/java/velocity/velocity-dep-1.4-dev.jar"/>
  -  
  +  <property name="velocity-dep.jar"        
value="/java/velocity/velocity-dep-1.4-dev.jar"/>

  <!-- ObjectBridge jar for 
optional OJB tags -->
  
  <property name="ojb.jar"                 
value="/java/ojb/ojb.jar"/>

  
   
   <!-- ========== Component Declarations ==================================== -->
   
  @@ -113,8 +111,7 @@
       <pathelement location="${junit.jar}"/>
       
       <!-- optional JARs -->
  -    <pathelement location="${beanshell.jar}"/>
  -    <pathelement location="${bsf.jar}"/>
  +    <pathelement location="${ojb.jar}"/>

    <pathelement 
location="${beanshell.jar}"/>

    <pathelement location="${bsf.jar}"/>
       <pathelement location="${pnuts.jar}"/>
       <pathelement location="${rhino.jar}"/>
       <pathelement location="${tools.jar}"/>
  @@ -140,7 +137,7 @@
       <pathelement location="${commons-digester.jar}"/>
       <pathelement location="${junit.jar}"/>

    <pathelement 
location="${database.jar}"/>

    
       <!-- optional JARs -->
  -    <pathelement location="${beanshell.jar}"/>
  +    <pathelement location="${ojb.jar}"/>

    <pathelement 
location="${beanshell.jar}"/>
       <pathelement location="${bsf.jar}"/>
       <pathelement location="${pnuts.jar}"/>
       <pathelement location="${rhino.jar}"/>
  @@ -157,9 +154,7 @@
   <!-- ========== Source files to be compiled =============================== -->
     <patternset id="javac.source.files">
       <!-- Optionally includes engines based on dependencies being present -->
  -    <exclude name="**/beanshell/**" unless="beanshell.present"/>
  -    <exclude name="**/bsf/**" unless="bsf.present"/>
  -  </patternset>
  +    <exclude name="**/ojb/**" unless="ojb.present"/>

    <exclude 
name="**/beanshell/**" unless="beanshell.present"/>

    <exclude name="**/bsf/**" 
unless="bsf.present"/>

  </patternset>
   
   <!-- ========== Executable Targets ======================================== -->
   
  @@ -170,11 +165,7 @@
       <filter  token="name"                  value="${component.package}"/>
       <filter  token="version"               value="${component.version}"/>
   
  -    <!-- set the conditional compilations -->
  -    <available property="bsf.present"
  -               classpathref="compile.classpath"
  -               classname="com.ibm.bsf.BSFEngine"/>
  -
  +    <!-- set the conditional compilations -->


    <available 
property="ojb.present"

               classpathref="compile.classpath"

              
 classname="ojb.broker.PersistenceBroker"/>



    <available property="bsf.present"

 
              classpathref="compile.classpath"

               
classname="com.ibm.bsf.BSFEngine"/>


       <available property="beanshell.present"
                  classpathref="compile.classpath"
                  classname="bsh.Interpreter"/>
  @@ -191,12 +182,9 @@
                  classpathref="compile.classpath"
                  classname="org.mozilla.javascript.Scriptable"/>
     </target>
  -
  +
     <!-- Warn the user about items not being compiled                        -->
  -  <target name="checkBsf" unless="bsf.present">
  -    <echo message="Warning: BSF dependencies were not resolved."/>
  -  </target>
  -  <target name="checkBeanShell" unless="beanshell.present">
  +  <target name="checkOjb" unless="obj.present">

    <echo message="Warning: OJB 
dependencies were not resolved."/>

  </target>

  <target name="checkBsf" 
unless="bsf.present">

    <echo message="Warning: BSF dependencies were not 
resolved."/>

  </target>

  <target name="checkBeanShell" unless="beanshell.present">
       <echo message="Warning: BeanShell dependencies were not resolved."/>
     </target>
     <target name="checkJPython" unless="jpython.present">
  
  
  
  1.7       +1 -1      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ExprTag.java
  
  Index: ExprTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ExprTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ExprTag.java      16 May 2002 16:29:52 -0000      1.6
  +++ ExprTag.java      16 May 2002 18:20:35 -0000      1.7
  @@ -1 +1 @@
  -/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ExprTag.java,v
 1.6 2002/05/16 16:29:52 jstrachan Exp $
 * $Revision: 1.6 $
 * $Date: 2002/05/16 
16:29:52 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: ExprTag.java,v 1.6 
2002/05/16 16:29:52 jstrachan Exp $
 */

package org.apache.commons.jelly.tags.core;

import org.apache.commons.jelly.JellyContext;

import org.apache.commons.jelly.Script;

import org.apache.commons.jelly.TagSupport;

import 
org.apache.commons.jelly.XMLOutput;

import 
org.apache.commons.jelly.expression.Expression;

import 
org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

/** A 
tag which evaluates an expression
  *
  * @author <a 
href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version $Revision: 1.6 $
  
*/

public class ExprTag extends TagSupport {

        /** The Log to which logging 
calls will be made. */

   private static final Log log = 
LogFactory.getLog(ExprTag.class);

      /** The expression to evaluate. */

    
private Expression value;

     public ExprTag() {

    }

     // Tag interface

     
 //------------------------------------------------------------------------- 

  
public void doTag(XMLOutput output) throws Exception {

                if (value != 
null) {

                  String text = value.evaluateAsString(context);

            
            if (text != null) {

                           output.write(text);

      
             }

             }

     }

     // Properties

 
//-------------------------------------------------------------------------            
    

   /** Sets the XPath expression to evaluate. */

 public void 
setValue(Expression value) {

              this.value = value;

   }

}
  \ No newline at end of file
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ExprTag.java,v
 1.7 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.7 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: ExprTag.java,v 1.7 
2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.core;

import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.expression.Expression;

import 
org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/** A 
tag which evaluates an expression
  *
  * @author <a 
href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version $Revision: 1.7 $
  
*/
public class ExprTag extends TagSupport {

    /** The Log to which logging calls 
will be made. */
    private static final Log log = LogFactory.getLog(ExprTag.class);

    /** The expression to evaluate. */
    private Expression value;

    public 
ExprTag() {
    }

    // Tag interface
    
//------------------------------------------------------------------------- 
    
public void doTag(XMLOutput output) throws Exception {
        if (value != null) {
   
         String text = value.evaluateAsString(context);
            if (text != null) 
{
                output.write(text);
            }
        }
    }

    // Properties
    //-------------------------------------------------------------------------        
        
    /** Sets the XPath expression to evaluate. */
    public void 
setValue(Expression value) {
        this.value = value;
    }
}
  \ No newline at end of file
  
  
  
  1.5       +1 -103    
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IfTag.java
  
  Index: IfTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IfTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IfTag.java        16 May 2002 16:29:52 -0000      1.4
  +++ IfTag.java        16 May 2002 18:20:35 -0000      1.5
  @@ -1,103 +1 @@
  -/*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IfTag.java,v
 1.4 2002/05/16 16:29:52 jstrachan Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/05/16 16:29:52 $
  - *
  - * ====================================================================
  - *
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    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
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - * 
  - * $Id: IfTag.java,v 1.4 2002/05/16 16:29:52 jstrachan Exp $
  - */
  -package org.apache.commons.jelly.tags.core;
  -
  -import java.io.IOException;
  -import java.io.Writer;
  -
  -import org.apache.commons.jelly.JellyContext;
  -import org.apache.commons.jelly.Script;
  -import org.apache.commons.jelly.TagSupport;
  -import org.apache.commons.jelly.XMLOutput;
  -import org.apache.commons.jelly.expression.Expression;
  -
  -/** A tag which conditionally evaluates its body based on some condition
  -  *
  -  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  -  * @version $Revision: 1.4 $
  -  */
  -public class IfTag extends TagSupport {
  -
  -    /** The expression to evaluate. */
  -    private Expression test;        
  -
  -    public IfTag() {
  -    }
  -
  -    // Tag interface
  -    //------------------------------------------------------------------------- 
  -    public void doTag(XMLOutput output) throws Exception {
  -        if ( test != null ) {
  -            if ( test.evaluateAsBoolean( context ) ) {
  -                getBody().run(context, output);
  -            }
  -        }
  -    }
  -
  -    // Properties
  -    //-------------------------------------------------------------------------     
           
  -    
  -    /** Sets the XPath expression to evaluate. */
  -    public void setTest(Expression test) {
  -        this.test = test;
  -    }
  -}
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IfTag.java,v
 1.5 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.5 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: IfTag.java,v 1.5 
2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.core;

import java.io.IOException;
import java.io.Writer;

import 
org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import 
org.apache.commons.jelly.expression.Expression;

/** A tag which conditionally 
evaluates its body based on some condition
  *
  * @author <a 
href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version $Revision: 1.5 $
  
*/
public class IfTag extends TagSupport {

    /** The expression to evaluate. */
    
private Expression test;

    public IfTag() {
    }

    // Tag interface
    
//------------------------------------------------------------------------- 
    
public void doTag(XMLOutput output) throws Exception {
        if (test != null) {
    
        if (test.evaluateAsBoolean(context)) {
                getBody().run(context, 
output);
            }
        }
        else {
            throw new JellyException( 
"This tag must have a 'test' attribute defined" );
        }

    }
    
    // 
Properties
    
//-------------------------------------------------------------------------            
    
    /** Sets the XPath expression to evaluate. */
    public void 
setTest(Expression test) {
        this.test = test;
    }
}
  \ No newline at end of file
  
  
  
  1.6       +1 -2      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/jelly.properties
  
  Index: jelly.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/jelly.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jelly.properties  15 May 2002 06:25:47 -0000      1.5
  +++ jelly.properties  16 May 2002 18:20:35 -0000      1.6
  @@ -2,8 +2,7 @@
   define      = org.apache.commons.jelly.tags.define.DefineTagLibrary
   xml         = org.apache.commons.jelly.tags.xml.XMLTagLibrary
sql         = 
org.apache.commons.jelly.tags.sql.SqlTagLibrary
   # optional taglibs
  -beanshell   = org.apache.commons.jelly.tags.beanshell.BeanShellTagLibrary
  -bsf         = org.apache.commons.jelly.tags.bsf.BSFTagLibrary
  +ojb                  = org.apache.commons.jelly.tags.ojb.OjbTagLibrary
beanshell   
= org.apache.commons.jelly.tags.beanshell.BeanShellTagLibrary
bsf         = 
org.apache.commons.jelly.tags.bsf.BSFTagLibrary
   javascript  = org.apache.commons.jelly.tags.bsf.JavaScriptTagLibrary
   jpython     = org.apache.commons.jelly.tags.bsf.JPythonTagLibrary
   pnuts       = org.apache.commons.jelly.tags.bsf.PNutsTagLibrary
  
  
  
  1.6       +1 -114    
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/SetTag.java
  
  Index: SetTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/SetTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SetTag.java       16 May 2002 16:29:55 -0000      1.5
  +++ SetTag.java       16 May 2002 18:20:35 -0000      1.6
  @@ -1,114 +1 @@
  -/*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/SetTag.java,v
 1.5 2002/05/16 16:29:55 jstrachan Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/05/16 16:29:55 $
  - *
  - * ====================================================================
  - *
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    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
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - * 
  - * $Id: SetTag.java,v 1.5 2002/05/16 16:29:55 jstrachan Exp $
  - */
  -package org.apache.commons.jelly.tags.xml;
  -
  -import java.io.Writer;
  -
  -import org.apache.commons.jelly.JellyContext;
  -import org.apache.commons.jelly.Script;
  -import org.apache.commons.jelly.TagSupport;
  -import org.apache.commons.jelly.XMLOutput;
  -
  -import org.dom4j.XPath;
  -
  -/** A tag which defines a variable from an XPath expression 
  -  *
  -  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  -  * @version $Revision: 1.5 $
  -  */
  -public class SetTag extends TagSupport {
  -
  -    /** The variable name to export. */
  -    private String var;
  -    /** The XPath expression to evaluate. */
  -    private XPath select;        
  -
  -    public SetTag() {
  -    }
  -
  -    // Tag interface
  -    //------------------------------------------------------------------------- 
  -    public void doTag(XMLOutput output) {
  -        if ( var == null ) {
  -            throw new IllegalArgumentException( "The var attribute cannot be null" 
);
  -        }
  -        if ( select != null ) {
  -            Object value = select.evaluate( null );
  -            context.setVariable( var, value );
  -        }
  -    }
  -
  -    // Properties
  -    //-------------------------------------------------------------------------     
           
  -    
  -    /** Sets the variable name to define for this expression
  -     */
  -    public void setVar(String var) {
  -        this.var = var;
  -    }
  -    
  -    /** Sets the XPath expression to evaluate. */
  -    public void setSelect(XPath select) {
  -        this.select = select;
  -    }
  -    
  -}
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/SetTag.java,v
 1.6 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.6 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: SetTag.java,v 1.6 
2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.xml;

import java.io.Writer;

import org.apache.commons.jelly.JellyContext;
import 
org.apache.commons.jelly.Script;
import org.apache.commons.jelly.TagSupport;
import 
org.apache.commons.jelly.XMLOutput;

import org.dom4j.XPath;

/** A tag which defines 
a variable from an XPath expression 
  *
  * @author <a 
href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version $Revision: 1.6 $
  
*/
public class SetTag extends XPathTagSupport {
    
    /** The variable name to 
export. */
    private String var;
    
    /** The XPath expression to evaluate. */   
 
    private XPath select;
    
    public SetTag() {
    }
    
    // Tag interface
    //------------------------------------------------------------------------- 
    
public void doTag(XMLOutput output) throws Exception {
        if (var == null) {
     
       throw new IllegalArgumentException("The var attribute cannot be null");
        
}
        Object xpathContext = getXPathContext();
        
        if (select == 
null) {
            select = createXPathFromBody(xpathContext);
        }
        
    
    Object value = select.evaluate(xpathContext);
        context.setVariable(var, 
value);
    }
    
    // Properties
    
//-------------------------------------------------------------------------            
    
    
    /** Sets the variable name to define for this expression
     */
    
public void setVar(String var) {
        this.var = var;
    }
    /** Sets the XPath 
expression to evaluate. */
    public void setSelect(XPath select) {
        
this.select = select;
    }
}
  \ No newline at end of file
  
  
  
  1.7       +1 -1      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ParseTag.java
  
  Index: ParseTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ParseTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ParseTag.java     16 May 2002 16:29:55 -0000      1.6
  +++ ParseTag.java     16 May 2002 18:20:35 -0000      1.7
  @@ -1 +1 @@
  -/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ParseTag.java,v
 1.6 2002/05/16 16:29:55 jstrachan Exp $
 * $Revision: 1.6 $
 * $Date: 2002/05/16 
16:29:55 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: ParseTag.java,v 1.6 
2002/05/16 16:29:55 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.xml;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import 
java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import 
java.net.MalformedURLException;
import java.net.URL;

import 
org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.Script;
import 
org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import 
org.dom4j.io.SAXContentHandler;
import org.dom4j.io.SAXReader;

import 
org.xml.sax.SAXException;

/** A tag which parses some XML and defines a variable with 
the parsed Document.
  * The XML can either be specified as its body or can be passed 
in via the
  * source property which can be a Reader, InputStream, URL or String URI.
 
 *
  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version 
$Revision: 1.6 $
  */
public class ParseTag extends TagSupport {

    /** The Log to 
which logging calls will be made. */
    private static final Log log = 
LogFactory.getLog(ParseTag.class);

    /** The variable that will be generated for 
the document */
    private String var;

    /** The source to parse, either a String 
URI, a Reader or InputStream */
    private Object source;

    // Optional properties 
not defined in JSTL
    /** whether XML validation is enabled or disabled */
    
private boolean validate;

    /** The SAXReader used to parser the document */
    
private SAXReader saxReader;

    public ParseTag() {
    }

    // Tag interface
    
//------------------------------------------------------------------------- 
    
public void doTag(XMLOutput output) throws Exception {
        if (var == null) {
     
       throw new IllegalArgumentException("The var attribute cannot be null");
        
}
        Document document = null;
        if (source == null) {
            
SAXContentHandler handler = new SAXContentHandler();
            XMLOutput newOutput = 
new XMLOutput(handler);
            handler.startDocument();
            
getBody().run(context, newOutput);
            handler.endDocument();
            
document = handler.getDocument();
            /*
                        // the 
following is inefficient as it requires a parse of the text
                        // 
but is left here in the code to see how it could be done.
            
                
        String text = getBodyText();
                        
                        
if ( log.isDebugEnabled() ) {
                            log.debug( "About to parse: 
" + text );
                        }
                        document = 
getSAXReader().read( new StringReader( text ) );
            */
        }
        else 
{
            if (source instanceof String) {
                document = 
getSAXReader().read((String) source);
            }
            else if (source 
instanceof Reader) {
                document = getSAXReader().read((Reader) source);
 
           }
            else if (source instanceof InputStream) {
                
document = getSAXReader().read((InputStream) source);
            }
            else 
if (source instanceof URL) {
                document = getSAXReader().read((URL) 
source);
            }
            else {
                throw new 
IllegalArgumentException(
                    "Invalid source argument. Must be a 
String, Reader, InputStream or URL."
                        + " Was type; "
          
              + source.getClass().getName()
                        + " with value: "
 
                       + source);
            }
        }
        
context.setVariable(var, document);
    }

    // Properties
    
//-------------------------------------------------------------------------            
    
    /** The variable name that will be used for the Document variable created
    
 */
    public String getVar() {
        return var;
    }

    /** Sets the variable 
name that will be used for the Document variable created
     */
    public void 
setVar(String var) {
        this.var = var;
    }

    /** @return whether XML 
validation is enabled or disabled */
    public boolean getValidate() {
        return 
validate;
    }

    /** Sets whether XML validation is enabled or disabled */
    
public void setValidate(boolean validate) {
        this.validate = validate;
    }

  
  /** @return the SAXReader used for parsing, creating one lazily if need be  */
    
public SAXReader getSAXReader() throws SAXException {
        if (saxReader == null) {
            saxReader = new SAXReader(validate);
        }
        return saxReader;
  
  }

    /** Sets the SAXReader used for parsing */
    public void 
setSAXReader(SAXReader saxReader) {
        this.saxReader = saxReader;
    }
}
  \ No newline at end of file
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ParseTag.java,v
 1.7 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.7 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: ParseTag.java,v 1.7 
2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.xml;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import 
java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import 
java.net.MalformedURLException;
import java.net.URL;

import 
org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.Script;
import 
org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import 
org.dom4j.io.SAXContentHandler;
import org.dom4j.io.SAXReader;

import 
org.xml.sax.SAXException;

/** A tag which parses some XML and defines a variable with 
the parsed Document.
  * The XML can either be specified as its body or can be passed 
in via the
  * xml property which can be a Reader, InputStream, URL or String URI.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version 
$Revision: 1.7 $
  */
public class ParseTag extends TagSupport {

    /** The Log to 
which logging calls will be made. */
    private static final Log log = 
LogFactory.getLog(ParseTag.class);

    /** The variable that will be generated for 
the document */
    private String var;

    /** The xml to parse, either a String 
URI, a Reader or InputStream */
    private Object xml;

    // Optional properties 
not defined in JSTL
    /** whether XML validation is enabled or disabled */
    
private boolean validate;

    /** The SAXReader used to parser the document */
    
private SAXReader saxReader;

    public ParseTag() {
    }

    // Tag interface
    
//------------------------------------------------------------------------- 
    
public void doTag(XMLOutput output) throws Exception {
        if (var == null) {
     
       throw new IllegalArgumentException("The var attribute cannot be null");
        
}
        Document document = null;
        if (xml == null) {
            
SAXContentHandler handler = new SAXContentHandler();
            XMLOutput newOutput = 
new XMLOutput(handler);
            handler.startDocument();
            
getBody().run(context, newOutput);
            handler.endDocument();
            
document = handler.getDocument();
            /*
                        // the 
following is inefficient as it requires a parse of the text
                        // 
but is left here in the code to see how it could be done.
            
                
        String text = getBodyText();
                        
                        
if ( log.isDebugEnabled() ) {
                            log.debug( "About to parse: 
" + text );
                        }
                        document = 
getSAXReader().read( new StringReader( text ) );
            */
        }
        else 
{
            if (xml instanceof String) {
                document = 
getSAXReader().read((String) xml);
            }
            else if (xml instanceof 
Reader) {
                document = getSAXReader().read((Reader) xml);
            }
 
           else if (xml instanceof InputStream) {
                document = 
getSAXReader().read((InputStream) xml);
            }
            else if (xml 
instanceof URL) {
                document = getSAXReader().read((URL) xml);
          
  }
            else {
                throw new IllegalArgumentException(
            
        "Invalid xml argument. Must be a String, Reader, InputStream or URL."
         
               + " Was type; "
                        + xml.getClass().getName()
     
                   + " with value: "
                        + xml);
            }
    
    }
        context.setVariable(var, document);
    }

    // Properties
    
//-------------------------------------------------------------------------            
    
    /** The variable name that will be used for the Document variable created
    
 */
    public String getVar() {
        return var;
    }

    /** Sets the variable 
name that will be used for the Document variable created
     */
    public void 
setVar(String var) {
        this.var = var;
    }
    
    /** Sets the source of the 
XML which is either a String URI, Reader or InputStream */
    public void 
setXml(Object xml) {
        this.xml = xml;
    }

    /** @return whether XML 
validation is enabled or disabled */
    public boolean getValidate() {
        return 
validate;
    }

    /** Sets whether XML validation is enabled or disabled */
    
public void setValidate(boolean validate) {
        this.validate = validate;
    }

  
  /** @return the SAXReader used for parsing, creating one lazily if need be  */
    
public SAXReader getSAXReader() throws SAXException {
        if (saxReader == null) {
            saxReader = new SAXReader(validate);
        }
        return saxReader;
  
  }

    /** Sets the SAXReader used for parsing */
    public void 
setSAXReader(SAXReader saxReader) {
        this.saxReader = saxReader;
    }
}
  \ No newline at end of file
  
  
  
  1.6       +1 -120    
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ForEachTag.java
  
  Index: ForEachTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ForEachTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ForEachTag.java   16 May 2002 16:29:54 -0000      1.5
  +++ ForEachTag.java   16 May 2002 18:20:35 -0000      1.6
  @@ -1,120 +1 @@
  -/*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ForEachTag.java,v
 1.5 2002/05/16 16:29:54 jstrachan Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/05/16 16:29:54 $
  - *
  - * ====================================================================
  - *
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    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
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - * 
  - * $Id: ForEachTag.java,v 1.5 2002/05/16 16:29:54 jstrachan Exp $
  - */
  -package org.apache.commons.jelly.tags.xml;
  -
  -import java.util.Iterator;
  -import java.util.List;
  -
  -import org.apache.commons.jelly.JellyContext;
  -import org.apache.commons.jelly.Script;
  -import org.apache.commons.jelly.TagSupport;
  -import org.apache.commons.jelly.XMLOutput;
  -
  -import org.dom4j.XPath;
  -
  -
  -/** A tag which performs an iteration over the results of an XPath expression
  -  *
  -  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  -  * @version $Revision: 1.5 $
  -  */
  -public class ForEachTag extends TagSupport {
  -
  -    /** Holds the XPath selector. */
  -    private XPath select;
  -    /** If specified then the current item iterated through will be defined
  -      * as the given variable name. */
  -    private String var;
  -    
  -    public ForEachTag() {
  -    }
  -
  -    // Tag interface
  -    //------------------------------------------------------------------------- 
  -    public void doTag(XMLOutput output) throws Exception {
  -        if ( select != null ) { 
  -            Iterator iter = select.selectNodes(null).iterator();
  -            while ( iter.hasNext() ) {
  -                Object value = iter.next();
  -                if (var != null) {
  -                    context.setVariable( var, value );
  -                }
  -                getBody().run(context, output);
  -            }
  -        }
  -    }
  -    
  -    // Properties
  -    //-------------------------------------------------------------------------     
               
  -    
  -    /** Sets the XPath selection expression
  -      */
  -    public void setSelect(XPath select) {
  -        this.select = select;
  -    }
  -    
  -    /** Sets the variable name to export for the item being iterated over
  -     */
  -    public void setVar(String var) {
  -        this.var = var;
  -    }
  -}
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ForEachTag.java,v
 1.6 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.6 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: ForEachTag.java,v 1.6 
2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.xml;

import java.util.Iterator;
import java.util.List;

import 
org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.Script;
import 
org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;

import org.dom4j.XPath;

/** A tag which performs an iteration over the results of an 
XPath expression
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>James 
Strachan</a>
  * @version $Revision: 1.6 $
  */
public class ForEachTag extends 
XPathTagSupport {

    /** Holds the XPath selector. */
    private XPath select;

    
/** If specified then the current item iterated through will be defined
      * as the 
given variable name. */
    private String var;

    /** The current iteration value 
*/
    private Object iterationValue;
    
    
    public ForEachTag() {
    }
    // 
Tag interface
    
//------------------------------------------------------------------------- 
    
public void doTag(XMLOutput output) throws Exception {
        if (select != null) {
  
          Iterator iter = select.selectNodes( getXPathContext() ).iterator();
         
   while (iter.hasNext()) {
                iterationValue = iter.next();
             
   if (var != null) {
                    context.setVariable(var, iterationValue);
   
             }
                getBody().run(context, output);
            }
        }
    }
    // Properties
    
//-------------------------------------------------------------------------            
        
    /** Sets the XPath selection expression
      */
    public void 
setSelect(XPath select) {
        this.select = select;
    }
    /** Sets the 
variable name to export for the item being iterated over
     */
    public void 
setVar(String var) {
        this.var = var;
    }
    
    /**
     * @return the 
current XPath iteration value
     *  so that any other XPath aware child tags to use
 
    */
    public Object getIterationValue() {
        return iterationValue;
    }
}
  \ No newline at end of file
  
  
  
  1.6       +1 -101    
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ExprTag.java
  
  Index: ExprTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ExprTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExprTag.java      16 May 2002 16:29:55 -0000      1.5
  +++ ExprTag.java      16 May 2002 18:20:35 -0000      1.6
  @@ -1,101 +1 @@
  -/*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ExprTag.java,v
 1.5 2002/05/16 16:29:55 jstrachan Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/05/16 16:29:55 $
  - *
  - * ====================================================================
  - *
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    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
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - * 
  - * $Id: ExprTag.java,v 1.5 2002/05/16 16:29:55 jstrachan Exp $
  - */
  -package org.apache.commons.jelly.tags.xml;
  -
  -import org.apache.commons.jelly.JellyContext;
  -import org.apache.commons.jelly.Script;
  -import org.apache.commons.jelly.TagSupport;
  -import org.apache.commons.jelly.XMLOutput;
  -
  -import org.dom4j.XPath;
  -
  -/** A tag which performs a string XPath expression; similar to &lt;xsl:value-of&gt;
  -  * in XSLT
  -  *
  -  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  -  * @version $Revision: 1.5 $
  -  */
  -public class ExprTag extends TagSupport {
  -
  -    /** The XPath expression to evaluate. */
  -    private XPath select;        
  -
  -    public ExprTag() {
  -    }
  -
  -    // Tag interface
  -    //------------------------------------------------------------------------- 
  -    public void doTag(XMLOutput output) throws Exception {
  -        if ( select != null ) {
  -            String text = select.valueOf( null );
  -            output.write( text );
  -        }
  -    }
  -
  -    // Properties
  -    //-------------------------------------------------------------------------     
           
  -    
  -    /** Sets the XPath expression to evaluate. */
  -    public void setSelect(XPath select) {
  -        this.select = select;
  -    }
  -}
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/ExprTag.java,v
 1.6 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.6 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: ExprTag.java,v 1.6 
2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.xml;

import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;

import org.dom4j.XPath;

/** A tag which performs a string XPath expression; similar 
to &lt;xsl:value-of&gt;
  * in XSLT
  *
  * @author <a 
href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version $Revision: 1.6 $
  
*/
public class ExprTag extends XPathTagSupport {

    /** The XPath expression to 
evaluate. */
    private XPath select;

    public ExprTag() {
    }

    // Tag 
interface
    
//------------------------------------------------------------------------- 
    
public void doTag(XMLOutput output) throws Exception {
        Object xpathContext = 
getXPathContext();
        
        if (select == null) {
            select = 
createXPathFromBody(xpathContext);
        }
        
        String text = 
select.valueOf(xpathContext);
        if ( text != null ) {
            
output.write(text);
        }
    }

    // Properties
    
//-------------------------------------------------------------------------            
    
    /** Sets the XPath expression to evaluate. */
    public void setSelect(XPath 
select) {
        this.select = select;
    }

    // Implementation methods
    
//-------------------------------------------------------------------------            
    
    protected Object getXPathContext() {
        ForEachTag tag = (ForEachTag) 
findAncestorWithClass( ForEachTag.class );    
        if ( tag != null ) {
           
 return tag.getXPathContext();
        }
        return null;
    }
    
}
  \ No newline at end of file
  
  
  
  1.4       +1 -99     
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java
  
  Index: XMLTagLibrary.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLTagLibrary.java        15 May 2002 06:25:49 -0000      1.3
  +++ XMLTagLibrary.java        16 May 2002 18:20:35 -0000      1.4
  @@ -1,99 +1 @@
  -/*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
 1.3 2002/05/15 06:25:49 jstrachan Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/05/15 06:25:49 $
  - *
  - * ====================================================================
  - *
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    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
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  - *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written
  - *    permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache"
  - *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - * 
  - * $Id: XMLTagLibrary.java,v 1.3 2002/05/15 06:25:49 jstrachan Exp $
  - */
  -package org.apache.commons.jelly.tags.xml;
  -
  -import java.io.IOException;
  -import java.io.Writer;
  -import java.util.Iterator;
  -import java.util.List;
  -
  -import org.apache.commons.jelly.JellyContext;
  -import org.apache.commons.jelly.Script;
  -import org.apache.commons.jelly.TagLibrary;
  -import org.apache.commons.jelly.expression.Expression;
  -import org.apache.commons.jelly.expression.ExpressionFactory;
  -
  -import org.dom4j.XPath;
  -
  -
  -/** Describes the Taglib. This class could be generated by XDoclet
  -  *
  -  * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  -  * @version $Revision: 1.3 $
  -  */
  -public class XMLTagLibrary extends TagLibrary {
  -
  -    public XMLTagLibrary() {
  -        registerTag( "expr", ExprTag.class );
  -        registerTag( "forEach", ForEachTag.class );
  -        registerTag( "parse", ParseTag.class );
  -        registerTag( "set", SetTag.class );
  -    }
  -    
  -    public Expression createExpression(ExpressionFactory factory, String tagName, 
String attributeName, String attributeValue) {
  -        if (attributeName.equals( "select" ) ) {
  -            return new XPathExpression( attributeValue );
  -        }
  -        // will use the default expression instead
  -        return null;
  -    }
  -}
  +/*
 * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
 1.4 2002/05/16 18:20:35 jstrachan Exp $
 * $Revision: 1.4 $
 * $Date: 2002/05/16 
18:20:35 $
 *
 * ====================================================================
 
*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache 
Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source 
and binary forms, with or without
 * modification, are permitted provided that the 
following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain 
the above copyright
 *    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
 *    the 
documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. 
The end-user documentation included with the redistribution, if
 *    any, must 
include the following acknowlegement:
 *       "This product includes software 
developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    
Alternately, this acknowlegement may appear in the software itself,
 *    if and 
wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The 
Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used 
to endorse or promote products derived
 *    from this software without prior written 
permission. For written
 *    permission, please contact [EMAIL PROTECTED]
 *
 * 5. 
Products derived from this software may not be called "Apache"
 *    nor may "Apache" 
appear in their names without prior written
 *    permission of the Apache Group.
 *
 
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE 
SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR 
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF
 * SUCH DAMAGE.
 * 
====================================================================
 *
 * This 
software consists of voluntary contributions made by many
 * individuals on behalf of 
the Apache Software Foundation.  For more
 * information on the Apache Software 
Foundation, please see
 * <http://www.apache.org/>.
 * 
 * $Id: XMLTagLibrary.java,v 
1.4 2002/05/16 18:20:35 jstrachan Exp $
 */
package org.apache.commons.jelly.tags.xml;

import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
import 
java.util.List;

import org.apache.commons.jelly.JellyContext;
import 
org.apache.commons.jelly.Script;
import org.apache.commons.jelly.TagLibrary;
import 
org.apache.commons.jelly.expression.Expression;
import 
org.apache.commons.jelly.expression.ExpressionFactory;

import org.dom4j.XPath;

/** 
Describes the Taglib. This class could be generated by XDoclet
  *
  * @author <a 
href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
  * @version $Revision: 1.4 $
  
*/
public class XMLTagLibrary extends TagLibrary {

    public XMLTagLibrary() {
      
  registerTag("out", ExprTag.class);
        registerTag("forEach", ForEachTag.class);
        registerTag("parse", ParseTag.class);
        registerTag("set", 
SetTag.class);
        
        // extensions to JSTL
        registerTag("expr", 
ExprTag.class);
    }

    public Expression createExpression(
        
ExpressionFactory factory,
        String tagName,
        String attributeName,
      
  String attributeValue) {

        if (attributeName.equals("select")) {
            
return new XPathExpression(attributeValue);
        }
        // will use the default 
expression instead
        return null;
    }
}
  \ No newline at end of file
  
  
  

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

Reply via email to