luehe       2002/10/30 10:20:21

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        JspDocumentParser.java PageDataImpl.java
                        TagConstants.java
  Log:
  Added "urn:jsptagdir:<path>" to XML view of JSP pages in JSP syntax
  
  Revision  Changes    Path
  1.23      +6 -8      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java
  
  Index: JspDocumentParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JspDocumentParser.java    28 Oct 2002 23:21:08 -0000      1.22
  +++ JspDocumentParser.java    30 Oct 2002 18:20:21 -0000      1.23
  @@ -86,8 +86,6 @@
       private static final String XMLNS = "xmlns:";
       private static final String XMLNS_JSP = "xmlns:jsp";
       private static final String JSP_VERSION = "version";
  -    private static final String URN_JSPTLD = "urn:jsptld:";
  -    private static final String URN_JSPTAGDIR = "urn:jsptagdir:";
       private static final String LEXICAL_HANDLER_PROPERTY
        = "http://xml.org/sax/properties/lexical-handler";;
   
  @@ -619,11 +617,11 @@
            for (int i=0; i<size; i++) {
                Node n = body.getNode(i);
                if (!(n instanceof Node.TemplateText)) {
  -                 String elemType = TagConstants.JSP_SCRIPTLET;
  +                 String elemType = JSP_SCRIPTLET;
                    if (scriptingElem instanceof Node.Declaration)
  -                     elemType = TagConstants.JSP_DECLARATION;
  +                     elemType = JSP_DECLARATION;
                    if (scriptingElem instanceof Node.Expression)
  -                     elemType = TagConstants.JSP_EXPRESSION;
  +                     elemType = JSP_EXPRESSION;
                    String msg = err.getString(
                           "jsp.error.parse.xml.scripting.invalid.body",
                        elemType);
  
  
  
  1.14      +13 -10    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java
  
  Index: PageDataImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PageDataImpl.java 28 Oct 2002 20:48:01 -0000      1.13
  +++ PageDataImpl.java 30 Oct 2002 18:20:21 -0000      1.14
  @@ -159,7 +159,8 @@
        * In addition, this Visitor converts any taglib directives into xmlns:
        * attributes and adds them to the jsp:root element of the XML view.
        */
  -    static class FirstPassVisitor extends Node.Visitor {
  +    static class FirstPassVisitor
  +             extends Node.Visitor implements TagConstants {
   
        private Node.Root root;
        private AttributesImpl rootAttrs;
  @@ -206,19 +207,21 @@
        }
   
        /*
  -      * Converts taglib directive into xmlns: attribute of jsp:root element.
  +      * Converts taglib directive into "xmlns:..." attribute of jsp:root
  +      * element.
         */
        public void visit(Node.TaglibDirective n) throws JasperException {
            Attributes attrs = n.getAttributes();
            if (attrs != null) {
  +             String type = "xmlns:" + attrs.getValue("prefix");
                String location = attrs.getValue("uri");
  -             if (location == null) {
  -                 // XXX JSP 2.0 CLARIFICATION NEEDED
  +             if (location != null) {
  +                 rootAttrs.addAttribute("", "", type, "CDATA", location);
  +             } else {
                    location = attrs.getValue("tagdir");
  +                 rootAttrs.addAttribute("", "", type, "CDATA",
  +                                        URN_JSPTAGDIR + location);
                }
  -             String prefix = attrs.getValue("prefix");
  -             rootAttrs.addAttribute("", "", "xmlns:" + prefix, "CDATA",
  -                                    location);
            }
        }
       }
  
  
  
  1.7       +9 -3      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagConstants.java
  
  Index: TagConstants.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagConstants.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TagConstants.java 28 Oct 2002 23:21:08 -0000      1.6
  +++ TagConstants.java 30 Oct 2002 18:20:21 -0000      1.7
  @@ -107,4 +107,10 @@
        = "jsp:directive.attribute";
       public static final String JSP_VARIABLE_DIRECTIVE
        = "jsp:directive.variable";
  +
  +    /*
  +     * Directive attributes
  +     */
  +    public static final String URN_JSPTAGDIR = "urn:jsptagdir:";
  +    public static final String URN_JSPTLD = "urn:jsptld:";
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>

Reply via email to