This patch fixes 3174 and 3351.  This fix was supplied by the submitter
[EMAIL PROTECTED]  This fix looks good.


Index: XmlOutputter.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/X
mlOutputter.java,v
retrieving revision 1.15
diff -u -r1.15 XmlOutputter.java
--- XmlOutputter.java   2001/07/25 01:49:10     1.15
+++ XmlOutputter.java   2001/09/05 20:48:36
@@ -94,7 +94,7 @@
     
     /*
      * Tells the nesting level of <jsp:root> tags encountered
-     * in the translation unit.
+     * in the translation unit.  This is currently unused.
      */
     private int jspRootLevel = 0;
 
@@ -121,15 +121,16 @@
      * A translation unit (JSP source file and any files included via 
      * the include directive) may encounter multiple <jsp:root>
      * tags. This method cumulates all attributes for the
-     * <jsp:root> tag.
+     * <jsp:root> tag.  It also ignores any xmlns:jsp and version
+     * attributes, in favor of the one generated by the compiler.
      */
     void addRootAttrs(Attributes attrs) {
        jspRootLevel++;
         int attrsLength = attrs.getLength();
         for (int i = 0; i < attrsLength; i++) {
            String qName = attrs.getQName(i);
-           if (attrs.getQName(i).startsWith("xmlns:jsp") 
-               && jspRootLevel > 1) continue; 
+           if ((qName.startsWith("xmlns:jsp") || 
+               qName.equals("version"))) continue;
             rootAttrs.addAttribute(attrs.getURI(i), attrs.getLocalName(i),
                 attrs.getQName(i), attrs.getType(i), attrs.getValue(i));
         }
@@ -149,9 +150,6 @@
      */
     void rootEnd() {
        jspRootLevel--;
-       if (jspRootLevel == 0) {
-           append("jsp:root");
-       }
     }
     
     /**
@@ -263,7 +261,6 @@
        StringBuffer buff = new StringBuffer();
         AttributesImpl attrs = new AttributesImpl();
 
-        
         append("jsp:root", rootAttrs, buff, false);
        buff.append(sb.toString());
         buff.append("</jsp:root>");


Reply via email to