jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaqu...@apache.org
Subject svn commit: r702507 - /incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/
Date Tue, 07 Oct 2008 15:06:02 GMT
Author: ajaquith
Date: Tue Oct  7 08:06:01 2008
New Revision: 702507

URL: http://svn.apache.org/viewvc?rev=702507&view=rev
Log:
Fixed parsing bug for JSP directives. Tweaked Javadocs and member names in NodeType. Added initialize() method for JspTransformer interface.

Modified:
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/AbstractNode.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JSPWikiJspTransformer.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspMigrator.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParser.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParserTest.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspTransformer.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/NodeType.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformer.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformerTest.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/Tag.java
    incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/TagTest.java

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/AbstractNode.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/AbstractNode.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/AbstractNode.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/AbstractNode.java Tue Oct  7 08:06:01 2008
@@ -206,9 +206,9 @@
      */
     public boolean isHtmlNode()
     {
-        return m_type == NodeType.HTML_START_TAG || m_type == NodeType.HTML_COMBINED_TAG || m_type == NodeType.UNRESOLVED_HTML_TAG
-               || m_type == NodeType.HTML_END_TAG || m_type == NodeType.DECLARATION || m_type == NodeType.HTML_LINK
-               || m_type == NodeType.HTML_META;
+        return m_type == NodeType.START_TAG || m_type == NodeType.EMPTY_ELEMENT_TAG || m_type == NodeType.UNRESOLVED_TAG
+               || m_type == NodeType.END_TAG || m_type == NodeType.DECLARATION || m_type == NodeType.LINK
+               || m_type == NodeType.META;
     }
 
     /*
@@ -230,7 +230,7 @@
      */
     public boolean isTagWithAttributes()
     {
-        return m_type == NodeType.HTML_START_TAG || m_type == NodeType.HTML_COMBINED_TAG || m_type == NodeType.UNRESOLVED_HTML_TAG;
+        return m_type == NodeType.START_TAG || m_type == NodeType.EMPTY_ELEMENT_TAG || m_type == NodeType.UNRESOLVED_TAG;
     }
 
     /*

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JSPWikiJspTransformer.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JSPWikiJspTransformer.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JSPWikiJspTransformer.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JSPWikiJspTransformer.java Tue Oct  7 08:06:01 2008
@@ -8,7 +8,16 @@
  */
 public class JSPWikiJspTransformer extends AbstractJspTransformer
 {
+    /**
+     * {@inheritDoc}
+     */
+    public void initialize( Map<String, Object> sharedState, JspDocument doc )
+    {
+    }
 
+    /**
+     * {@inheritDoc}
+     */
     public void transform( Map<String, Object> sharedState, JspDocument doc )
     {
         List<Node> nodes = doc.getNodes();
@@ -32,7 +41,7 @@
 
                 // Advise user about <input type="hidden"> or <stripes:hidden> tags
                 boolean isTypeHidden = false;
-                if ( tag.getType() != NodeType.HTML_END_TAG )
+                if ( tag.getType() != NodeType.END_TAG )
                 {
                     isTypeHidden = "stripes:hidden".equals( tag.getName() );
                     if( "input".equals( tag.getName() ) )
@@ -42,9 +51,13 @@
                     }
                     if( isTypeHidden )
                     {
-                        Attribute hidden = tag.getAttribute( "name" );
-                        message( hidden, "NOTE: hidden form input with name \"" + hidden.getValue()
-                                         + "\" should probably correspond to a Stripes ActionBean getter/settter. Refactor?" );
+                        String paramName = tag.hasAttribute( "name" ) ? tag.getAttribute( "name" ).getValue() : null;
+                        String paramValue = tag.hasAttribute( "value" ) ? tag.getAttribute( "value" ).getValue() : null;
+                        if ( paramName != null && paramValue != null )
+                        {
+                            message( tag, "NOTE: hidden form input sets parameter " + paramName
+                                     + "=\"" + paramValue + "\". This should probably correspond to a Stripes ActionBean getter/settter. Refactor?" );
+                        }
                     }
                 }
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspMigrator.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspMigrator.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspMigrator.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspMigrator.java Tue Oct  7 08:06:01 2008
@@ -4,16 +4,72 @@
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public class JspMigrator
 {
 
     /**
-     * @param args
+     * Key for a list of File objects stored in the shared-state array.
+     */
+    public static final String ALL_JSPS = "allJSPs";
+
+    /**
+     * Returns a list of files that match a specified extension, starting in a
+     * supplied directory and scanning each child directory recursively..
+     * 
+     * @param dir the directory to start in
+     * @param extension the extension to check, for example <code>.jsp</code>.
+     *            If the extension is "*", all files are returned
+     * @return the list of files
+     * @throws IOException
+     * @throws IllegalArgumentException if <code>dir</code> does not already
+     *             exist, or if <code>extension</code>
+     */
+    public static List<File> getFiles( File dir, String extension ) throws IOException
+    {
+        // Verify parameters
+        if( dir == null || extension == null )
+        {
+            throw new IllegalArgumentException( "Dir and extension must not be null." );
+        }
+
+        // Verify that the directory exists
+        if( !dir.exists() )
+        {
+            throw new IllegalArgumentException( "Dir " + dir.getPath() + " does not exist!" );
+        }
+
+        List<File> allFiles = new ArrayList<File>();
+
+        // Assemble list of files
+        for( File file : dir.listFiles() )
+        {
+            // If directory, migrate everything in it recursively
+            if( file.isDirectory() )
+            {
+                allFiles.addAll( getFiles( file, extension ) );
+            }
+
+            // Otherwise it's a file, so add it to the list
+            else
+            {
+                if( "*".equals( extension ) || file.getName().endsWith( extension ) )
+                {
+                    allFiles.add( file );
+                }
+            }
+        }
+        return allFiles;
+    }
+
+    /**
+     * Migrates a directory containing JSPs, and all of its subdirectories, to a
+     * destination directory.
+     * 
+     * @param args two Strings specifying the source and destination
+     *            directories, respectively. Both source and destination must
+     *            already exist, and may not be the same.
      */
     public static void main( String[] args )
     {
@@ -56,6 +112,20 @@
         }
     }
 
+    protected static String readSource( File src ) throws IOException
+    {
+        // Read in the file
+        FileReader reader = new FileReader( src );
+        StringBuffer s = new StringBuffer();
+        int ch = 0;
+        while ( (ch = reader.read()) != -1 )
+        {
+            s.append( (char) ch );
+        }
+        reader.close();
+        return s.toString();
+    }
+
     private List<JspTransformer> m_transformers = new ArrayList<JspTransformer>();
 
     private Map<String, Object> m_sharedState = new HashMap<String, Object>();
@@ -75,42 +145,47 @@
      * Migrates the contents of an entire directory from one location to
      * another.
      * 
-     * @param srcDir the source directory
+     * @param sourceDir the source directory
      * @param destDir the destination directory
      */
-    public void migrate( File srcDir, File destDir ) throws IOException
+    public void migrate( File sourceDir, File destDir ) throws IOException
     {
-        // Create the destination directory if it does not already exist
-        if( !destDir.exists() )
-        {
-            destDir.mkdir();
-        }
-
         // Clear the shared state
         m_sharedState.clear();
 
-        // Assemble list of files
-        for( File src : srcDir.listFiles() )
+        // Find the files we need to migrate
+        String sourcePath = sourceDir.getPath();
+        List<File> allFiles = Collections.unmodifiableList( getFiles( sourceDir, ".jsp" ) );
+        m_sharedState.put( ALL_JSPS, allFiles );
+
+        for( File src : allFiles )
         {
-            // If directory, migrate everything in it recursively
-            File dest = new File( destDir, src.getName() );
-            if( src.isDirectory() )
-            {
-                migrate( src, dest );
-            }
+            // Figure out the new file name
+            String destPath = src.getPath().substring( sourcePath.length() );
+            File dest = new File( destDir, destPath );
 
-            // Otherwise it's a file, so migrate it if it's a JSP
-            else
-            {
-                if( src.getName().endsWith( ".jsp" ) )
-                {
-                    migrateFile( src, dest );
-                }
-            }
+            // Create any directories we need
+            dest.getParentFile().mkdirs();
+
+            migrateFile( src, dest );
         }
     }
 
     /**
+     * Writes a String to a file.
+     * 
+     * @param dest the destination file
+     * @param contents the String to write to the file
+     * @throws IOException
+     */
+    private void writeDestination( File dest, String contents ) throws IOException
+    {
+        FileWriter writer = new FileWriter( dest );
+        writer.append( contents );
+        writer.close();
+    }
+
+    /**
      * Migrates a single file.
      * 
      * @param src the source file
@@ -137,32 +212,4 @@
         System.out.println( "    done [" + s.length() + " chars]." );
     }
 
-    /**
-     * Writes a String to a file.
-     * 
-     * @param dest the destination file
-     * @param contents the String to write to the file
-     * @throws IOException
-     */
-    private void writeDestination( File dest, String contents ) throws IOException
-    {
-        FileWriter writer = new FileWriter( dest );
-        writer.append( contents );
-        writer.close();
-    }
-
-    protected static String readSource( File src ) throws IOException
-    {
-        // Read in the file
-        FileReader reader = new FileReader( src );
-        StringBuffer s = new StringBuffer();
-        int ch = 0;
-        while ( (ch = reader.read()) != -1 )
-        {
-            s.append( (char) ch );
-        }
-        reader.close();
-        return s.toString();
-    }
-
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParser.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParser.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParser.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParser.java Tue Oct  7 08:06:01 2008
@@ -163,8 +163,18 @@
             ParseContext ctx = ParseContext.currentContext();
             ctx.setNode( node );
 
-            // Skip ahead if tag start > 1 char long
-            int increment = node.getType().getTagStart().length() - 1;
+            // Skip ahead until we get to the first name character
+            int pos = ctx.position();
+            int increment = node.getType().getTagStart().length();
+            String source = ctx.getSource();
+            while ( pos + increment < source.length() && Character.isWhitespace( source.charAt( pos + increment ) ) )
+            {
+                increment++;
+            }
+            
+            // Walk backwards one position
+            increment--;
+            
             for( int i = 0; i < increment; i++ )
             {
                 ctx.incrementPosition();
@@ -200,16 +210,16 @@
                 initNode( new Text( doc, NodeType.JSP_EXPRESSION ), Stage.CODE_OR_COMMENT );
             }
 
-            // <%@ + space means JSP directive
+            // <%@ + optional space means JSP directive
             else if( lookahead.startsWith( NodeType.JSP_DIRECTIVE.getTagStart() ) )
             {
                 initNode( new Tag( doc, NodeType.JSP_DIRECTIVE ), Stage.NAME );
             }
 
             // <!-- means HTML comment
-            else if( lookahead.startsWith( NodeType.HTML_COMMENT.getTagStart() ) )
+            else if( lookahead.startsWith( NodeType.COMMENT.getTagStart() ) )
             {
-                initNode( new Text( doc, NodeType.HTML_COMMENT ), Stage.CODE_OR_COMMENT );
+                initNode( new Text( doc, NodeType.COMMENT ), Stage.CODE_OR_COMMENT );
             }
 
             // Whitespace after <% means
@@ -241,16 +251,16 @@
             }
 
             // If </, it's an HTML end tag
-            else if( lookahead.startsWith( NodeType.HTML_END_TAG.getTagStart() ) )
+            else if( lookahead.startsWith( NodeType.END_TAG.getTagStart() ) )
             {
-                initNode( new Tag( doc, NodeType.HTML_END_TAG ), Stage.NAME );
+                initNode( new Tag( doc, NodeType.END_TAG ), Stage.NAME );
             }
 
             // Any other char means its HTML start tag
             // or combined tag
             else
             {
-                initNode( new Tag( doc, NodeType.UNRESOLVED_HTML_TAG ), Stage.NAME );
+                initNode( new Tag( doc, NodeType.UNRESOLVED_TAG ), Stage.NAME );
             }
         }
 
@@ -373,15 +383,15 @@
          * </p>
          * <ul>
          * <li>If the tag's type has not been determined (that is, its current
-         * type is {@link NodeType#UNRESOLVED_HTML_TAG}, its type is resolved
-         * to either {@link NodeType#HTML_COMBINED_TAG} or
-         * {@link NodeType#HTML_START_TAG}, depending on whether the last
+         * type is {@link NodeType#UNRESOLVED_TAG}, its type is resolved
+         * to either {@link NodeType#EMPTY_ELEMENT_TAG} or
+         * {@link NodeType#START_TAG}, depending on whether the last
          * character was /.
          * <li>
          * <li>If the tag's name has not been set, because the parser has not
          * encountered whitespace that delimits attributes, its name is set.</li>
-         * <li>If the tag is of type {@link NodeType#HTML_START_TAG} or
-         * {@link NodeType#HTML_START_TAG}, the current ParseContext is pushed
+         * <li>If the tag is of type {@link NodeType#START_TAG} or
+         * {@link NodeType#START_TAG}, the current ParseContext is pushed
          * on, or popped off, of the stack. In addition, if the tag is an end
          * tag, its parent is re-wired to the same parent as the start tag. This
          * makes the start and end tag logical peers, as they should be.</li>
@@ -400,24 +410,24 @@
             // Special case if we have a META or LINK tag
             if ( "LINK".equals( node.getName() ) )
             {
-                node.setType( NodeType.HTML_LINK );
+                node.setType( NodeType.LINK );
             }
             else if ( "META".equals( node.getName() ) )
             {
-                node.setType( NodeType.HTML_META );
+                node.setType( NodeType.META );
             }
 
             // Resolve tag type if not set
-            if( node.getType() == NodeType.UNRESOLVED_HTML_TAG )
+            if( node.getType() == NodeType.UNRESOLVED_TAG )
             {
                 String lookbehind = ctx.lookbehind( 2 );
-                if( NodeType.HTML_COMBINED_TAG.getTagEnd().equals( lookbehind ) )
+                if( NodeType.EMPTY_ELEMENT_TAG.getTagEnd().equals( lookbehind ) )
                 {
-                    node.setType( NodeType.HTML_COMBINED_TAG );
+                    node.setType( NodeType.EMPTY_ELEMENT_TAG );
                 }
                 else
                 {
-                    node.setType( NodeType.HTML_START_TAG );
+                    node.setType( NodeType.START_TAG );
                 }
             }
 
@@ -433,13 +443,13 @@
             // otherwise start new Text
             switch( node.getType() )
             {
-                case HTML_START_TAG: {
+                case START_TAG: {
                     // Add the start tag to parent, and push it onto stack
                     endStage();
                     ctx = ParseContext.push();
                     break;
                 }
-                case HTML_END_TAG: {
+                case END_TAG: {
                     // Make end tag the peer of the start tag
                     Node startTag = node.getParent();
                     node.setParent( startTag.getParent() );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParserTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParserTest.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParserTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspParserTest.java Tue Oct  7 08:06:01 2008
@@ -65,7 +65,7 @@
         assertEquals( 1, nodes.size() );
         Tag tag = (Tag)nodes.get( 0 );
         assertEquals( "META", tag.getName() );
-        assertEquals( NodeType.HTML_META, tag.getType() );
+        assertEquals( NodeType.META, tag.getType() );
         assertEquals( 2, tag.getAttributes().size() );
         assertEquals( "name", tag.getAttribute( "name" ).getName() );
         assertEquals( "Author", tag.getAttribute( "name" ).getValue() );
@@ -87,7 +87,7 @@
         assertEquals( 1, nodes.size() );
         Tag tag = (Tag)nodes.get( 0 );
         assertEquals( "LINK", tag.getName() );
-        assertEquals( NodeType.HTML_LINK, tag.getType() );
+        assertEquals( NodeType.LINK, tag.getType() );
         assertEquals( 4, tag.getAttributes().size() );
         assertEquals( "rel", tag.getAttribute( "rel" ).getName() );
         assertEquals( "Start", tag.getAttribute( "rel" ).getValue() );
@@ -115,7 +115,7 @@
         Node node;
         node = nodes.get( 0 );
         assertEquals( "a", node.getName() );
-        assertEquals( NodeType.HTML_START_TAG, node.getType() );
+        assertEquals( NodeType.START_TAG, node.getType() );
         assertEquals( "<a <b test=\"c\">selected=\"d\"</b> >", node.toString() );
         
         // Second node is a Text node
@@ -126,12 +126,12 @@
         // Third node is an end tag
         node = nodes.get( 2 );
         assertEquals( "a", node.getName() );
-        assertEquals( NodeType.HTML_END_TAG, node.getType() );
+        assertEquals( NodeType.END_TAG, node.getType() );
         
         // First and third node are children of the root
         assertEquals( 2, doc.getRoot().getChildren().size() );
-        assertEquals( NodeType.HTML_START_TAG, doc.getRoot().getChildren().get( 0 ).getType() );
-        assertEquals( NodeType.HTML_END_TAG, doc.getRoot().getChildren().get( 1 ).getType() );
+        assertEquals( NodeType.START_TAG, doc.getRoot().getChildren().get( 0 ).getType() );
+        assertEquals( NodeType.END_TAG, doc.getRoot().getChildren().get( 1 ).getType() );
         
         // Test first node: should have 3 attributes (2 dynamic)
         Tag tag = (Tag)nodes.get( 0 );
@@ -171,7 +171,7 @@
         assertEquals( "a", node.getName() );
         assertEquals( null, node.getValue() );
         assertEquals( 0, node.getChildren().size() );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "<a b=\"cd\" />", node.toString() );
 
         // Verify attributes
@@ -221,7 +221,7 @@
         assertEquals( "  ", node.toString() );
     }
     
-    public void testCombinedTag() throws Exception
+    public void testEmptyElementTag() throws Exception
     {
         String s = "<foo />";
 
@@ -239,7 +239,7 @@
         assertEquals( "foo", node.getName() );
         assertEquals( null, node.getValue() );
         assertEquals( 0, node.getChildren().size() );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "<foo/>", node.toString() );
     }
 
@@ -284,6 +284,31 @@
         attribute = node.getAttributes().get( 0 );
         assertEquals( "import", attribute.getName() );
         assertEquals( "org.apache.log4j.*", attribute.getValue() );
+        assertEquals( "<%@ page import=\"org.apache.log4j.*\" %>", node.toString());
+    }
+    
+    public void testParseDirectiveNoLeadingSpace() throws Exception
+    {
+        String s = "<%@page import=\"org.apache.log4j.*\"%>";
+
+        // Parse the contents of the file
+        JspParser parser = new JspParser();
+        JspDocument doc = parser.parse( s );
+
+        // Results in one node
+        List<Node> nodes = doc.getNodes();
+        assertEquals( 1, nodes.size() );
+        Tag node;
+        Node attribute;
+
+        // Verify directive
+        node = (Tag) nodes.get( 0 );
+        assertEquals( "page", node.getName() );
+        assertEquals( 1, node.getAttributes().size() );
+        attribute = node.getAttributes().get( 0 );
+        assertEquals( "import", attribute.getName() );
+        assertEquals( "org.apache.log4j.*", attribute.getValue() );
+        assertEquals( "<%@ page import=\"org.apache.log4j.*\" %>", node.toString());
     }
 
     public void testParse() throws Exception
@@ -484,7 +509,7 @@
         assertEquals( 277, node.getStart() );
         assertEquals( 354, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
         assertEquals( 17, node.getSiblings().size() );
         assertEquals( "stripes:useActionBean", node.getName() );
@@ -555,7 +580,7 @@
         assertEquals( 1513, node.getStart() );
         assertEquals( 1553, node.getEnd() );
         assertEquals( 0, node.getChildren().size() );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( NodeType.ROOT, node.getParent().getType() );
         assertEquals( 17, node.getSiblings().size() );
         assertEquals( "wiki:Include", node.getName() );
@@ -599,7 +624,7 @@
 
         // AbstractNode 1 is <foo> with 1 attribute
         node = nodes.get( 1 );
-        assertEquals( NodeType.HTML_START_TAG, node.getType() );
+        assertEquals( NodeType.START_TAG, node.getType() );
         assertEquals( "<foo attribute1=\"1\">", node.toString() );
         assertEquals( "foo", node.getName() );
         assertEquals( "  <bar attribute2=\"2\" attribute3=\"3\" />  ", node.getValue() );
@@ -629,7 +654,7 @@
 
         // Check AbstractNode 1, child 1 -- should be <bar>
         node = nodes.get( 1 ).getChildren().get( 1 );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "<bar attribute2=\"2\" attribute3=\"3\" />", node.toString() );
         assertEquals( "bar", node.getName() );
         assertEquals( 0, node.getChildren().size() );
@@ -652,7 +677,7 @@
 
         // AbstractNode 5 (</foo) has no attributes
         node = nodes.get( 5 );
-        assertEquals( NodeType.HTML_END_TAG, node.getType() );
+        assertEquals( NodeType.END_TAG, node.getType() );
         assertEquals( null, node.getValue() );
         assertEquals( "foo", node.getName() );
         assertEquals( 0, ((Tag) node).getAttributes().size() );
@@ -706,7 +731,7 @@
         assertEquals( 3, node.getColumn() );
         assertEquals( 2, node.getStart() );
         assertEquals( 52, node.getEnd() );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "<wiki:Include page=\"<%=contentPage%>\" var=\'Foo\' />", node.toString() );
         assertEquals( "wiki:Include", node.getName() );
         assertEquals( null, node.getValue() );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspTransformer.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspTransformer.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspTransformer.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/JspTransformer.java Tue Oct  7 08:06:01 2008
@@ -8,12 +8,24 @@
 public interface JspTransformer
 {
     /**
-     * Executes the transformation on the JSP and returns the result.
+     * Initializes the transformer. This method should be called only once, when
+     * the transformer is initialized.
      * 
      * @param sharedState a map containing key/value pairs that represent any
      *            shared-state information that this method might need during
      *            transformation.
-     * @param doc the JSP to transform.
+     * @param doc the JSP to transform
+     */
+    public void initialize( Map<String, Object> sharedState, JspDocument doc );
+
+    /**
+     * Executes the transformation on the JSP and returns the result. This
+     * method is called for each File migrated.
+     * 
+     * @param sharedState a map containing key/value pairs that represent any
+     *            shared-state information that this method might need during
+     *            transformation.
+     * @param doc the JSP to transform
      */
     public void transform( Map<String, Object> sharedState, JspDocument doc );
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/NodeType.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/NodeType.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/NodeType.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/NodeType.java Tue Oct  7 08:06:01 2008
@@ -17,22 +17,22 @@
     CDATA("<![CDATA[","]]>"),
     /** DOCTYPE declaration */
     DOCTYPE("<!DOCTYPE ", ">"),
-    /** HTML comment tag */
-    HTML_COMMENT("<!--", "-->"),
-    /** HTML start tag */
-    HTML_START_TAG("<", ">"),
-    /** HTML LINK tag. */
-    HTML_LINK("<",">"),
-    /** HTML META tag. */
-    HTML_META("<",">"),
-    /** HTML end tag */
-    HTML_END_TAG("</", ">"),
+    /** HTML, XML or XHTML comment tag */
+    COMMENT("<!--", "-->"),
+    /** HTML, XML or XHTML start tag */
+    START_TAG("<", ">"),
+    /** HTML or XHTML LINK tag. */
+    LINK("<",">"),
+    /** HTML or XHTML META tag. */
+    META("<",">"),
+    /** HTML, XML or XHTML end tag */
+    END_TAG("</", ">"),
     /** XML declaration, <em>e.g.</em>, <code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code>. */
     DECLARATION("<?","?>"),
-    /** HTML end tag */
-    HTML_COMBINED_TAG("<", "/>"),
-    /** HTML tag, but not sure whether it's a start, end or combined tag. */
-    UNRESOLVED_HTML_TAG("<", null),
+    /** HTML, XML or XHTML empty-element tag. */
+    EMPTY_ELEMENT_TAG("<", "/>"),
+    /** HTML tag, but not sure whether it's a start, end or empty-element tag. */
+    UNRESOLVED_TAG("<", null),
     /** JSP comments, e.g., &lt;%-- comment --%&gt; */
     JSP_COMMENT("<%--", "--%>"),
     /**
@@ -51,7 +51,7 @@
      * JSP page, import or taglib directive, e.g., &lt;%@ include... %&gt;
      * &lt;%@ page... %&gt; &lt;%@ taglib... %&gt;
      */
-    JSP_DIRECTIVE("<%@ ", "%>");
+    JSP_DIRECTIVE("<%@", "%>");
     private final String m_tagStart;
 
     private final String m_tagEnd;

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformer.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformer.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformer.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformer.java Tue Oct  7 08:06:01 2008
@@ -8,7 +8,16 @@
  */
 public class StripesJspTransformer extends AbstractJspTransformer
 {
+    /**
+     * {@inheritDoc}
+     */
+    public void initialize( Map<String, Object> sharedState, JspDocument doc )
+    {
+    }
 
+    /**
+     * {@inheritDoc}
+     */
     public void transform( Map<String, Object> sharedState, JspDocument doc )
     {
         boolean migrated = false;
@@ -34,10 +43,17 @@
                     migrated = migrateInputTag( tag ) || migrated;
                 }
 
+                // Change <textarea> to <stripes:textarea>
                 else if( "textarea".equals( tag.getName() ) )
                 {
                     migrated = migrateTextArea( tag ) || migrated;
                 }
+                
+                // Remove any <fmt:setLocale> tags (and their children)
+                else if ( "fmt:setLocale".equals( tag.getName() ) )
+                {
+                    removeSetLocale( tag );
+                }
             }
         }
 
@@ -116,7 +132,7 @@
                             JspDocument doc = tag.getJspDocument();
                             String name = param.substring( 0, param.indexOf( '=' ) );
                             String value = param.substring( name.length() + 1 );
-                            Tag stripesParam = new Tag( doc, NodeType.HTML_COMBINED_TAG );
+                            Tag stripesParam = new Tag( doc, NodeType.EMPTY_ELEMENT_TAG );
                             stripesParam.setName( "stripes:param" );
                             Attribute nameAttribute = new Attribute( doc );
                             nameAttribute.setName( "name" );
@@ -156,7 +172,7 @@
             {
                 Node nameAttribute = tag.getAttribute( "name" );
                 String nameValue = nameAttribute == null ? "(not set)" : nameAttribute.getName();
-                message( nameAttribute, "NOTE: the \"name\" attribute of <input type=\"submit\" is \"" + nameValue + "\"" );
+                message( nameAttribute, "NOTE: name=\"" + nameValue + "\"" );
             }
 
             // Move type attribute to qname
@@ -234,4 +250,15 @@
         return migrated;
     }
 
+    /**
+     * Removes the &lt;fmt:setLocale&gt; tag and advises the user.
+     * 
+     * @param tag the tag to remove
+     */
+    private void removeSetLocale( Tag tag )
+    {
+        Node parent = tag.getParent();
+        parent.removeChild( tag );
+        message( tag, "Removed <fmt:setLocale> tag because Stripes LocalePicker does this instead." );
+    }
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformerTest.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformerTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/StripesJspTransformerTest.java Tue Oct  7 08:06:01 2008
@@ -52,12 +52,12 @@
 
         // Verify old tag is still there too
         node = doc.getNodes().get( 2 );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "stripes:form", node.getName() );
         assertEquals( 0, ((Tag) node).getAttributes().size() );
     }
 
-    public void testFormCombinedTag() throws Exception
+    public void testFormEmptyElementTag() throws Exception
     {
         String s = "<form accept-charset=\"UTF-8\" method=\"POST\" />";
         JspDocument doc = new JspParser().parse( s );
@@ -112,7 +112,7 @@
         // After transformation, the "type" attribute is deleted
         assertEquals( 3, doc.getNodes().size() ); // Added Stripes taglib + linebreak
         node = doc.getNodes().get( 2 ); // First 2 are injected Stripes taglib+llinebreak
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "stripes:password", node.getName() );
         assertEquals( 4, ((Tag) node).getAttributes().size() );
         assertEquals( 0, node.getChildren().size() );
@@ -129,14 +129,14 @@
         // value becomes child node
         assertEquals( 5, doc.getNodes().size() ); // Added Stripes taglib +linebreak
         Node node = doc.getNodes().get( 2 ); // First 2 are injected Stripes taglib+ llinebreak
-        assertEquals( NodeType.HTML_START_TAG, node.getType() );
+        assertEquals( NodeType.START_TAG, node.getType() );
         assertEquals( "stripes:password", node.getName() );
         assertEquals( 3, ((Tag) node).getAttributes().size() );
 
         // The value attribute should show up as a child node
         assertEquals( 1, node.getChildren().size() );
         node = node.getChildren().get( 0 );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "wiki:Variable", node.getName() );
     }
 
@@ -150,7 +150,7 @@
         // After transformation, the tag name is renamed
         assertEquals( 3, doc.getNodes().size() ); // Added Stripes taglib + linebreak
         Node node = doc.getNodes().get( 2 ); // First 2 are injected Stripes taglib+ llinebreak
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "stripes:textarea", node.getName() );
         assertEquals( 5, ((Tag) node).getAttributes().size() );
 
@@ -173,13 +173,13 @@
         // After transformation, the tag name is renamed & tag is split
         assertEquals( 5, doc.getNodes().size() ); // Added Stripes taglib + linebreak
         Node node = doc.getNodes().get( 2 ); // First 2 are injected Stripes taglib+ llinebreak
-        assertEquals( NodeType.HTML_START_TAG, node.getType() );
+        assertEquals( NodeType.START_TAG, node.getType() );
         assertEquals( "stripes:textarea", node.getName() );
         assertEquals( 4, ((Tag) node).getAttributes().size() ); // Value attribute vanishes...
 
         // Verify newly created end tag
         node = doc.getNodes().get( 4 );
-        assertEquals( NodeType.HTML_END_TAG, node.getType() );
+        assertEquals( NodeType.END_TAG, node.getType() );
         assertEquals( "stripes:textarea", node.getName() );
 
         // The value attribute should have moved to child nodes
@@ -204,7 +204,7 @@
         // After transformation, the tag name is stays the same (no name attribute...)
         assertEquals( 1, doc.getNodes().size() ); // NO Stripes taglib or  linebreak
         Node node = doc.getNodes().get( 0 );
-        assertEquals( NodeType.HTML_COMBINED_TAG, node.getType() );
+        assertEquals( NodeType.EMPTY_ELEMENT_TAG, node.getType() );
         assertEquals( "textarea", node.getName() );
         assertEquals( 4, ((Tag) node).getAttributes().size() );
     }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/Tag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/Tag.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/Tag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/Tag.java Tue Oct  7 08:06:01 2008
@@ -8,70 +8,34 @@
 import java.util.List;
 
 /**
- * Node implementation representing an HTML or XML tag.
+ * Node implementation representing an HTML tag, XML tag or JSP tag.
  */
 public class Tag extends AbstractNode
 {
     private List<Attribute> m_attributes = new ArrayList<Attribute>();
 
     /**
+     * Constructs a new Tag.
      * @param doc the parent JspDocument
-     * @param type
+     * @param type the node type
      */
     public Tag( JspDocument doc, NodeType type )
     {
         super( doc, type );
     }
 
-    public void addAttribute( Attribute attribute )
-    {
-        m_attributes.add( attribute );
-    }
-
-    /**
-     * Returns the attribute whose name matches a supplied string, or
-     * <code>null</code> if not found.
-     * 
-     * @param name the named attribute to search for
-     * @return the attribute if found, or <code>null</code>
-     */
-    public Attribute getAttribute( String name )
-    {
-        if( name == null )
-        {
-            throw new IllegalArgumentException( "Name cannot be null. " );
-        }
-        for( Attribute attribute : m_attributes )
-        {
-            if( name.equals( attribute.getName() ) )
-            {
-                return attribute;
-            }
-        }
-        return null;
-    }
-
     /**
-     * Returns the attributes of this node, as a defensive copy of the
-     * internally-cached list.
-     * 
-     * @return
+     * Adds an attribute to the Tag.
+     * @param attribute the attribute to add
      */
-    public List<Attribute> getAttributes()
-    {
-        List<Attribute> attributesCopy = new ArrayList<Attribute>();
-        attributesCopy.addAll( m_attributes );
-        return Collections.unmodifiableList( attributesCopy );
-    }
-
-    public void removeAttribute( Attribute attribute )
+    public void addAttribute( Attribute attribute )
     {
-        m_attributes.remove( attribute );
+        m_attributes.add( attribute );
     }
 
     /**
-     * Adds a child to the current Node. If the Node is of type
-     * {@link NodeType#HTML_COMBINED_TAG}, the tag will be split into two nodes
+     * {@inheritDoc} If the Node is of type
+     * {@link NodeType#EMPTY_ELEMENT_TAG}, the tag will be split into two nodes
      * (start tag and end tag), with the child Node inserted between the two.
      * 
      * @param node the node to insert
@@ -92,9 +56,7 @@
     }
 
     /**
-     * Adds a child to the current Node before a specified position in the list
-     * of children. If the position is 0, the Node will be inserted before the
-     * first child. If the Node is of type {@link NodeType#HTML_COMBINED_TAG},
+     * {@inheritDoc} If the Node is of type {@link NodeType#EMPTY_ELEMENT_TAG},
      * the tag will be split into two nodes (start tag and end tag), with the
      * child Node inserted between the two.
      * 
@@ -106,7 +68,7 @@
     public void addChild( Node node, int index )
     {
         // If this node is a "combined node," split it into two
-        if( m_type == NodeType.HTML_COMBINED_TAG )
+        if( m_type == NodeType.EMPTY_ELEMENT_TAG )
         {
             if( m_parent == null )
             {
@@ -114,10 +76,10 @@
             }
 
             // Change node type to start tag
-            m_type = NodeType.HTML_START_TAG;
+            m_type = NodeType.START_TAG;
 
             // Build new end tag & set its parent
-            Tag endNode = new Tag( m_doc, NodeType.HTML_END_TAG );
+            Tag endNode = new Tag( m_doc, NodeType.END_TAG );
             endNode.setName( m_name );
             endNode.setParent( m_parent );
 
@@ -138,9 +100,48 @@
         super.addChild( node, index );
     }
 
+    /**
+     * Returns the attribute whose name matches a supplied string, or
+     * <code>null</code> if not found.
+     * 
+     * @param name the named attribute to search for
+     * @return the attribute if found, or <code>null</code>
+     */
+    public Attribute getAttribute( String name )
+    {
+        if( name == null )
+        {
+            throw new IllegalArgumentException( "Name cannot be null. " );
+        }
+        for( Attribute attribute : m_attributes )
+        {
+            if( name.equals( attribute.getName() ) )
+            {
+                return attribute;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns an unmodifiable copy of the attributes of this Tag.
+     * 
+     * @return the list of attributes
+     */
+    public List<Attribute> getAttributes()
+    {
+        List<Attribute> attributesCopy = new ArrayList<Attribute>();
+        attributesCopy.addAll( m_attributes );
+        return Collections.unmodifiableList( attributesCopy );
+    }
+
+    /**
+     * Returns the values of all child nodes, concatenated, if the Tag is a start tag; <code>null</code> otherwise.
+     * @return the Tag value nodes
+     */
     public String getValue()
     {
-        if( m_type != NodeType.HTML_START_TAG )
+        if( m_type != NodeType.START_TAG )
         {
             return null;
         }
@@ -148,6 +149,26 @@
     }
 
     /**
+     * Returns <code>true</code> if the Tag has an attribute with a supplied name, 
+     * and <code>false</code> otherwise.
+     * @param name the attribute to search for
+     * @return the result
+     */
+    public boolean hasAttribute( String name )
+    {
+        return getAttribute( name ) != null;
+    }
+    
+    /**
+     * Removes an attribute from the Tag.
+     * @param the attribute to remove
+     */
+    public void removeAttribute( Attribute attribute )
+    {
+        m_attributes.remove( attribute );
+    }
+
+    /**
      * Returns the string that represents the Tag, including the name and
      * attributes, but not any child nodes.
      */
@@ -171,6 +192,12 @@
 
         // Print tag start
         sb.append( tagStart );
+        
+        // For JSP directives, add a leading space
+        if ( m_type == NodeType.JSP_DIRECTIVE )
+        {
+            sb.append( ' ' );
+        }
 
         // If Tag, print start/end plus attributes.
         if( isHtmlNode() || m_type == NodeType.JSP_DIRECTIVE )
@@ -200,7 +227,7 @@
                         }
                     }
                 }
-                if( lastType == NodeType.DYNAMIC_ATTRIBUTE || m_type == NodeType.JSP_DIRECTIVE || m_type == NodeType.HTML_COMBINED_TAG )
+                if( lastType == NodeType.DYNAMIC_ATTRIBUTE || m_type == NodeType.JSP_DIRECTIVE || m_type == NodeType.EMPTY_ELEMENT_TAG )
                 {
                     sb.append( ' ' );
                 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/TagTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/TagTest.java?rev=702507&r1=702506&r2=702507&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/TagTest.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/tests/com/ecyrd/jspwiki/ui/stripes/TagTest.java Tue Oct  7 08:06:01 2008
@@ -6,19 +6,19 @@
 
 public class TagTest extends TestCase
 {
-    public void testAddChildCombined()
+    public void testAddChildEmptyElement()
     {
         JspDocument doc = new JspDocument();
         
         // Set up tag <foo/>
-        Tag parentTag = new Tag( doc, NodeType.HTML_COMBINED_TAG );
+        Tag parentTag = new Tag( doc, NodeType.EMPTY_ELEMENT_TAG );
         parentTag.setName( "foo" );
         doc.getRoot().addChild( parentTag );
         assertEquals( "<foo/>", parentTag.toString() );
         assertEquals( 1, doc.getRoot().getChildren().size() );
         
         // Add child tag <bar/>
-        Tag childTag = new Tag( doc, NodeType.HTML_COMBINED_TAG );
+        Tag childTag = new Tag( doc, NodeType.EMPTY_ELEMENT_TAG );
         childTag.setName( "bar" );
         parentTag.addChild( childTag );
         
@@ -32,14 +32,14 @@
         JspDocument doc = new JspDocument();
         
         // Set up tag <foo>
-        Tag parentTag = new Tag( doc, NodeType.HTML_START_TAG);
+        Tag parentTag = new Tag( doc, NodeType.START_TAG);
         parentTag.setName( "foo" );
         doc.getRoot().addChild( parentTag );
         assertEquals( "<foo>", parentTag.toString() );
         assertEquals( 1, doc.getRoot().getChildren().size() );
         
         // Add child tag <bar/>
-        Tag childTag = new Tag( doc, NodeType.HTML_COMBINED_TAG );
+        Tag childTag = new Tag( doc, NodeType.EMPTY_ELEMENT_TAG );
         childTag.setName( "bar" );
         parentTag.addChild( childTag );
         
@@ -53,20 +53,20 @@
         JspDocument doc = new JspDocument();
         
         // Set up tag <foo>
-        Tag parentTag = new Tag( doc, NodeType.HTML_START_TAG);
+        Tag parentTag = new Tag( doc, NodeType.START_TAG);
         parentTag.setName( "foo" );
         doc.getRoot().addChild( parentTag );
         assertEquals( "<foo>", parentTag.toString() );
         assertEquals( 1, doc.getRoot().getChildren().size() );
         
         // Add child tag <bar/>
-        Tag childTag = new Tag( doc, NodeType.HTML_COMBINED_TAG );
+        Tag childTag = new Tag( doc, NodeType.EMPTY_ELEMENT_TAG );
         childTag.setName( "bar" );
         parentTag.addChild( childTag );
         assertEquals( 1, doc.getRoot().getChildren().size() );
         
         // Add a second child <golf/>  before <bar>
-        childTag = new Tag( doc, NodeType.HTML_COMBINED_TAG );
+        childTag = new Tag( doc, NodeType.EMPTY_ELEMENT_TAG );
         childTag.setName( "golf" );
         parentTag.addChild( childTag, 0 );
         



Mime
View raw message