pierred     00/11/30 15:33:02

  Modified:    jasper/src/share/org/apache/jasper/compiler
                        ParserController.java
  Log:
  A JSP page uses the JSP 1.2 XML syntax only if the
  jsp:root element is present.
  
  -----
  As reported on tomcat-dev:
  
  Danno Ferrin:
  >
  > I am sorry to start this thread here, but I believe that jasper-4.0's
  > behavior is in error.  The behavior I think the spec calls for in
  > determining if a page is a JSP Document (xml jsp) or an XMl document
  > with JSP markup is the presence or absence of a jsp:root element.
  > [...]
  
  Hans Bergsten:
  I agree. JSP 1.1 says that everything that's not a JSP element is
  treated as template text, and that any type of markup (text) language
  can be used as template text. This means that a pure XML document,
  with an <?xml version="1.0?> element at the top, is a valid JSP
  page using the JSP 1.1 syntax.
  
  The best (only?) way to identify a page that uses the JSP 1.2 XML syntax
  is what you suggest: look for a jsp:root element. This should be
  clarified in the JSP 1.2 spec.
  
  Submitted by: Danno Ferrin <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.8       +10 -15    
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java
  
  Index: ParserController.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ParserController.java     2000/10/28 03:20:22     1.7
  +++ ParserController.java     2000/11/30 23:33:02     1.8
  @@ -111,7 +111,6 @@
        * Static information used in the process of figuring out
        * the kind of document we're dealing with.
        */
  -    private static final String XML_PROLOG_TAG = "<?xml";
       private static final String JSP_ROOT_TAG   = "<jsp:root";
   
       /*
  @@ -241,20 +240,16 @@
           jspReader.setSingleFile(true);
           Mark startMark = jspReader.mark();
   
  -        // check the prolog (ideally it's been included if it is an xml doc)
  -        Mark mark = jspReader.skipUntil(XML_PROLOG_TAG);
  -        if (mark != null) {
  -            isXml = true;
  -        } else {
  -            // must have the jsp:root tag
  -            jspReader.reset(startMark);
  -            mark = jspReader.skipUntil(JSP_ROOT_TAG);
  -            if (mark != null) {
  -                isXml = true;
  -            } else {
  -                isXml = false;
  -            }
  -        }
  +     // Check for the jsp:root tag
  +     // No check for xml prolog, since nothing prevents a page
  +     // to output XML and still use JSP syntax.
  +     jspReader.reset(startMark);
  +     Mark mark = jspReader.skipUntil(JSP_ROOT_TAG);
  +     if (mark != null) {
  +         isXml = true;
  +     } else {
  +         isXml = false;
  +     }
   
        // Figure out the encoding of the page
        // FIXME: We assume xml parser will take care of
  
  
  

Reply via email to