Hi again - since no one voiced an opinion on the right way to approach this bug, I've done the simplest possible fix and attached a patch. This change will cause Jasper to always emit its own hardcoded values for the xmlns:jsp and version attributes of the <jsp:root> tag, ignoring any occurrences of those attributes in documents. This makes processing of JSP documents consistent whether they were specified in XML or JSP syntax. I also made the trivial fix to the double end tag problem. I suspect that a more elaborate solution might be desirable for the version attribute, since if the document says it is version 1.3 (when we have such a version), but the compiler only handles 1.2, this ought to indicate a problem. But I'm not sure how to do that at this point, so this patch gets past the immediate problems that make valid documents unusable. Cheers - Mark
Index: XmlOutputter.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/XmlOutputter.java,v retrieving revision 1.15 diff -u -p --unified=5 -r1.15 XmlOutputter.java --- XmlOutputter.java 2001/07/25 01:49:10 1.15 +++ XmlOutputter.java 2001/08/20 18:14:35 @@ -126,12 +126,12 @@ public class XmlOutputter { 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)); } } @@ -142,18 +142,15 @@ public class XmlOutputter { rootAttrs.addAttribute("", "xmlns", "xmlns:" + prefix, "CDATA", uri); } /* - * Only put the </jsp:root> tag when we're dealing - * with the top level 'container' page. + * Don't append the root end tag here because the + * getPageData method will append it later. */ void rootEnd() { jspRootLevel--; - if (jspRootLevel == 0) { - append("jsp:root"); - } } /** * Append the cdata to the XML stream. */