tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kin...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler PageDataImpl.java
Date Tue, 12 Aug 2003 00:52:50 GMT
kinman      2003/08/11 17:52:50

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        PageDataImpl.java
  Log:
  - When including a JSP document (written in the XML syntax),
    in the resulting XML View of the translation unit the
    root element of the included segment must have the default
    namespace reset to "".
  
  Revision  Changes    Path
  1.32      +19 -3     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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- PageDataImpl.java	11 May 2003 22:54:47 -0000	1.31
  +++ PageDataImpl.java	12 Aug 2003 00:52:50 -0000	1.32
  @@ -271,6 +271,7 @@
   	private StringBuffer buf;
   	private Compiler compiler;
   	private String jspIdPrefix;
  +	private boolean resetDefaultNS = false;
   
   	// Current value of jsp:id attribute
   	private int jspId;
  @@ -295,7 +296,12 @@
   		appendXmlProlog();
   		appendTag(n);
   	    } else {
  +		boolean resetDefaultNSSave = resetDefaultNS;
  +		if (n.isXmlSyntax()) {
  +		    resetDefaultNS = true;
  +		}
   		visitBody(n);
  +		resetDefaultNS = resetDefaultNSSave;
   	    }
   	}
   
  @@ -400,11 +406,15 @@
           }
   
   	public void visit(Node.CustomTag n) throws JasperException {
  +	    boolean resetDefaultNSSave = resetDefaultNS;
   	    appendTag(n);
  +	    resetDefaultNS = resetDefaultNSSave;
   	}
   
   	public void visit(Node.UninterpretedTag n) throws JasperException {
  +	    boolean resetDefaultNSSave = resetDefaultNS;
   	    appendTag(n);
  +	    resetDefaultNS = resetDefaultNSSave;
   	}
   
   	public void visit(Node.JspText n) throws JasperException {
  @@ -690,10 +700,16 @@
   	     */
   	    attrs = n.getNonTaglibXmlnsAttributes();
   	    len = (attrs == null) ? 0 : attrs.getLength();
  +	    boolean defaultNSSeen = false;
   	    for (int i=0; i<len; i++) {
   		String name = attrs.getQName(i);
   		String value = attrs.getValue(i);
   		buf.append("  ").append(name).append("=\"").append(value).append("\"\n");
  +		defaultNSSeen = "xmlns".equals(name);
  +	    }
  +	    if (resetDefaultNS && !defaultNSSeen) {
  +		buf.append("  xmlns=\"\"\n");
  +		resetDefaultNS = false;
   	    }
   
   	    /*
  
  
  

Mime
View raw message