Update of 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-web/src/main/java/org/xdoclet/plugin/web
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7390/plugin-web/src/main/java/org/xdoclet/plugin/web

Modified Files:
        TaglibPlugin.java TaglibPlugin.jelly 
Log Message:
XDP-93 : Support for taglib-jsp2 xsd declaration

Index: TaglibPlugin.jelly
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-web/src/main/java/org/xdoclet/plugin/web/TaglibPlugin.jelly,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** TaglibPlugin.jelly  1 Jun 2005 11:19:57 -0000       1.11
--- TaglibPlugin.jelly  30 Aug 2005 02:03:06 -0000      1.12
***************
*** 2,20 ****
  
  <j:jelly xmlns:j="jelly:core" xmlns:jxml="jelly:xml"
!     xmlns:x="jelly:org.xdoclet.plugin.web.jelly.XdocletTaglib">
! 
!   <j:if test="${plugin.needsDoctype()}">
!     <jxml:doctype name="taglib"
!         publicId="${plugin.publicId}"
!         systemId="${plugin.systemId}"/>
!   </j:if>
  
!     <taglib>
!     <!-- TODO : jsp2 needs an xsd declation:
!     version="2.0"
!     xmlns="http://java.sun.com/xml/ns/j2ee";
!     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
!     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
web-jsptaglibrary_2_0.xsd"-->
  
          <tlib-version>${plugin.taglibversion}</tlib-version>
          <jsp-version>${plugin.jspversion}</jsp-version>
--- 2,19 ----
  
  <j:jelly xmlns:j="jelly:core" xmlns:jxml="jelly:xml"
!          xmlns:x="jelly:org.xdoclet.plugin.web.jelly.XdocletTaglib">
  
!     <j:if test="${plugin.needsDoctype()}">
!         <jxml:doctype name="taglib"
!                       publicId="${plugin.publicId}"
!                       systemId="${plugin.systemId}"/>
!     </j:if>
  
+     <jxml:element URI="${plugin.schemaXmlNs}" name="taglib">
+         <j:if test="${plugin.needsSchema()}">
+             <jxml:attribute URI="${plugin.schemaXmlNsXsi}" 
name="xsi:schemaLocation" 
trim="true">${plugin.schemaXsiSchemaLocation}</jxml:attribute>
+             <jxml:attribute name="version" 
trim="true">${plugin.jspversion}</jxml:attribute>
+         </j:if>
+         <jxml:replaceNamespace toURI="${plugin.schemaXmlNs}">
          <tlib-version>${plugin.taglibversion}</tlib-version>
          <jsp-version>${plugin.jspversion}</jsp-version>
***************
*** 48,52 ****
                  <x:condelement tag="large-icon" doclettag="${tagtag}" 
property="large-icon"/>
                  <x:condelement tag="description" doclettag="${tagtag}" 
property="description"/>
!              <j:forEach var="var" 
items="${tag.getTagsByName('jsp.variable')}">
                      <variable>
                          <x:condelement tag="name-given" doclettag="${var}" 
property="name-given"/>
--- 47,51 ----
                  <x:condelement tag="large-icon" doclettag="${tagtag}" 
property="large-icon"/>
                  <x:condelement tag="description" doclettag="${tagtag}" 
property="description"/>
!                 <j:forEach var="var" 
items="${tag.getTagsByName('jsp.variable')}">
                      <variable>
                          <x:condelement tag="name-given" doclettag="${var}" 
property="name-given"/>
***************
*** 68,74 ****
                      </attribute>
                  </j:forEach>
!                </tag>
          </j:forEach>
!     </taglib>
  
  </j:jelly>
--- 67,74 ----
                      </attribute>
                  </j:forEach>
!             </tag>
          </j:forEach>
!         </jxml:replaceNamespace>
!     </jxml:element>
  
  </j:jelly>

Index: TaglibPlugin.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-web/src/main/java/org/xdoclet/plugin/web/TaglibPlugin.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** TaglibPlugin.java   31 May 2005 11:26:42 -0000      1.16
--- TaglibPlugin.java   30 Aug 2005 02:03:06 -0000      1.17
***************
*** 27,33 ****
   *
   * <p><br/><br/>created     Oct 20, 2003 10:04:09 PM</p>
!  * @author     Gr&eacute;gory Joseph
!  * @author     $Author$ (last edit)
!  * @version    $Revision$
   */
  public class TaglibPlugin extends QDoxPlugin {
--- 27,33 ----
   *
   * <p><br/><br/>created     Oct 20, 2003 10:04:09 PM</p>
!  * @author Gr&eacute;gory Joseph
!  * @author $Author$ (last edit)
!  * @version $Revision$
   */
  public class TaglibPlugin extends QDoxPlugin {
***************
*** 63,70 ****
      /** maps jsp version to Tag interfaces */
      private static final HashMap tagInterfaces = new HashMap();
      static {
!         tagInterfaces.put("1.1",  new 
String[]{"javax.servlet.jsp.tagext.Tag"});
!         tagInterfaces.put("1.2",  new 
String[]{"javax.servlet.jsp.tagext.Tag"});
!         tagInterfaces.put("2.0",  new 
String[]{"javax.servlet.jsp.tagext.Tag", "javax.servlet.jsp.tagext.JspTag"});
      }
  
--- 63,71 ----
      /** maps jsp version to Tag interfaces */
      private static final HashMap tagInterfaces = new HashMap();
+ 
      static {
!         tagInterfaces.put("1.1", new 
String[]{"javax.servlet.jsp.tagext.Tag"});
!         tagInterfaces.put("1.2", new 
String[]{"javax.servlet.jsp.tagext.Tag"});
!         tagInterfaces.put("2.0", new String[]{"javax.servlet.jsp.tagext.Tag", 
"javax.servlet.jsp.tagext.JspTag"});
      }
  
***************
*** 104,117 ****
      }
  
      /**
!      * Returns a Collection of classes implementing 
javax.servlet.jsp.tagext.Tag
       * and which have a jsp.tag tag.
-      *
-      * @return
       */
      public Collection getTags() {
          // filter out non-tags classes
          ArrayList tags = new ArrayList();
!         Predicate predicate = new 
ClassTagPredicate((String[])tagInterfaces.get(getJspversion()), "jsp.tag");
          if (allClasses == null) {
              allClasses = metadataProvider.getMetadata();
--- 105,120 ----
      }
  
+     public boolean needsSchema() {
+         return getJspversion().startsWith("2.");
+     }
+ 
      /**
!      * @return a Collection of classes implementing 
javax.servlet.jsp.tagext.Tag
       * and which have a jsp.tag tag.
       */
      public Collection getTags() {
          // filter out non-tags classes
          ArrayList tags = new ArrayList();
!         Predicate predicate = new ClassTagPredicate((String[]) 
tagInterfaces.get(getJspversion()), "jsp.tag");
          if (allClasses == null) {
              allClasses = metadataProvider.getMetadata();
***************
*** 122,130 ****
  
      /**
!      * Returns a collection of JavaMethod from a class, which have a
!      * jsp.attribute tag.
!      *
!      * @param clazz
!      * @return
       */
      public Collection getAttributeMethods(JavaClass clazz) {
--- 125,130 ----
  
      /**
!      * @return a collection of JavaMethod from a  given class,
!      * which have a jsp.attribute tag.
       */
      public Collection getAttributeMethods(JavaClass clazz) {
***************
*** 263,265 ****
--- 263,277 ----
          return (String) systemIDs.get(getJspversion());
      }
+ 
+     public String getSchemaXmlNs() {
+         return needsSchema() ? "http://java.sun.com/xml/ns/j2ee"; : null;
+     }
+ 
+     public String getSchemaXmlNsXsi() {
+         return needsSchema() ? "http://www.w3.org/2001/XMLSchema-instance"; : 
null;
+     }
+ 
+     public String getSchemaXsiSchemaLocation() {
+         return needsSchema() ? "http://java.sun.com/xml/ns/j2ee 
web-jsptaglibrary_2_0.xsd" : null;
+     }
  }



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits

Reply via email to