bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/TagLibraryInfoImpl.java
private void parseTLD(JspCompilationContext ctxt,
			  String uri, InputStream in, URL jarFileUrl) 
        throws JasperException
    {
        List<TagInfo> tagVector = new ArrayList<TagInfo>();
        List<TagFileInfo> tagFileVector = new ArrayList<TagFileInfo>();
        HashMap<String, FunctionInfo> functionTable =
            new HashMap<String, FunctionInfo>();

        // Create an iterator over the child elements of our <taglib> element
        ParserUtils pu = new ParserUtils();
        TreeNode tld = pu.parseXMLDocument(uri, in);

	// Check to see if the <taglib> root element contains a 'version'
	// attribute, which was added in JSP 2.0 to replace the <jsp-version>
	// subelement
	this.jspversion = tld.findAttribute("version");

        // Process each child element of our <taglib> element
        Iterator list = tld.findChildren();

        while (list.hasNext()) {
            TreeNode element = (TreeNode) list.next();
            String tname = element.getName();

            if ("tlibversion".equals(tname)                    // JSP 1.1
		        || "tlib-version".equals(tname)) {     // JSP 1.2
                this.tlibversion = element.getBody();
            } else if ("jspversion".equals(tname)
		        || "jsp-version".equals(tname)) {
                this.jspversion = element.getBody();
            } else if ("shortname".equals(tname) ||
                     "short-name".equals(tname))
                this.shortname = element.getBody();
            else if ("uri".equals(tname))
                this.urn = element.getBody();
            else if ("info".equals(tname) ||
                     "description".equals(tname))
                this.info = element.getBody();
            else if ("validator".equals(tname))
                this.tagLibraryValidator = createValidator(element);
            else if ("tag".equals(tname))
                tagVector.add(createTagInfo(element, jspversion));
            else if ("tag-file".equals(tname)) {
		TagFileInfo tagFileInfo = createTagFileInfo(element, uri,
							    jarFileUrl);
                tagFileVector.add(tagFileInfo);
	    } else if ("function".equals(tname)) {         // JSP2.0
		FunctionInfo funcInfo = createFunctionInfo(element);
		String funcName = funcInfo.getName();
		if (functionTable.containsKey(funcName)) {
		    err.jspError("jsp.error.tld.fn.duplicate.name",
				 funcName, uri);

		}
                functionTable.put(funcName, funcInfo);
            } else if ("display-name".equals(tname) ||    // Ignored elements
                     "small-icon".equals(tname) ||
                     "large-icon".equals(tname) ||
                     "listener".equals(tname)) {
                ;
	    } else if ("taglib-extension".equals(tname)) {
		// Recognized but ignored
            } else {
                err.jspError("jsp.error.unknown.element.in.taglib", tname);
            }
        }

	if (tlibversion == null) {
	    err.jspError("jsp.error.tld.mandatory.element.missing", 
			 "tlib-version");
	}
	if (jspversion == null) {
	    err.jspError("jsp.error.tld.mandatory.element.missing",
			 "jsp-version");
	}

        this.tags = tagVector.toArray(new TagInfo[0]);
        this.tagFiles = tagFileVector.toArray(new TagFileInfo[0]);

        this.functions = new FunctionInfo[functionTable.size()];
	int i=0;
        for (FunctionInfo funcInfo: functionTable.values()) {
	    this.functions[i++] = funcInfo;
	}
    }
private void parseTLD(JspCompilationContext ctxt,
			  String uri, InputStream in, URL jarFileUrl) 
        throws JasperException
    {
        List<TagInfo> tagVector = new ArrayList<TagInfo>();
        List<TagFileInfo> tagFileVector = new ArrayList<TagFileInfo>();
        HashMap<String, FunctionInfo> functionTable =
            new HashMap<String, FunctionInfo>();

        // Create an iterator over the child elements of our <taglib> element
        ParserUtils pu = new ParserUtils();
        TreeNode tld = pu.parseXMLDocument(uri, in);

	// Check to see if the <taglib> root element contains a 'version'
	// attribute, which was added in JSP 2.0 to replace the <jsp-version>
	// subelement
	this.jspversion = tld.findAttribute("version");

        // Process each child element of our <taglib> element
        Iterator list = tld.findChildren();

        while (list.hasNext()) {
            TreeNode element = (TreeNode) list.next();
            String tname = element.getName();

            if ("tlibversion".equals(tname)                    // JSP 1.1
		        || "tlib-version".equals(tname)) {     // JSP 1.2
                this.tlibversion = element.getBody();
            } else if ("jspversion".equals(tname)
		        || "jsp-version".equals(tname)) {
                this.jspversion = element.getBody();
            } else if ("shortname".equals(tname) ||
                     "short-name".equals(tname))
                this.shortname = element.getBody();
            else if ("uri".equals(tname))
                this.urn = element.getBody();
            else if ("info".equals(tname) ||
                     "description".equals(tname))
                this.info = element.getBody();
            else if ("validator".equals(tname))
                this.tagLibraryValidator = createValidator(element);
            else if ("tag".equals(tname))
                tagVector.add(createTagInfo(element, jspversion));
            else if ("tag-file".equals(tname)) {
		TagFileInfo tagFileInfo = createTagFileInfo(element, uri,
							    jarFileUrl);
                tagFileVector.add(tagFileInfo);
	    } else if ("function".equals(tname)) {         // JSP2.0
		FunctionInfo funcInfo = createFunctionInfo(element);
		String funcName = funcInfo.getName();
		if (functionTable.containsKey(funcName)) {
		    err.jspError("jsp.error.tld.fn.duplicate.name",
				 funcName, uri);

		}
                functionTable.put(funcName, funcInfo);
            } else if ("display-name".equals(tname) ||    // Ignored elements
                     "small-icon".equals(tname) ||
                     "large-icon".equals(tname) ||
                     "listener".equals(tname)) {
                ;
	    } else if ("taglib-extension".equals(tname)) {
		// Recognized but ignored
            } else {
                err.jspError("jsp.error.unknown.element.in.taglib", tname);
            }
        }

	if (tlibversion == null) {
	    err.jspError("jsp.error.tld.mandatory.element.missing", 
			 "tlib-version");
	}
	if (jspversion == null) {
	    err.jspError("jsp.error.tld.mandatory.element.missing",
			 "jsp-version");
	}

        this.tags = tagVector.toArray(new TagInfo[0]);
        this.tagFiles = tagFileVector.toArray(new TagFileInfo[0]);

        this.functions = new FunctionInfo[functionTable.size()];
	int i=0;
        for (FunctionInfo funcInfo: functionTable.values()) {
	    this.functions[i++] = funcInfo;
	}
    }
private void parseTLD ( JspCompilationContext ctxt , String uri , InputStream in , URL jarFileUrl ) throws JasperException { List < TagInfo > tagVector = new ArrayList < TagInfo > ( ) ; List < TagFileInfo > tagFileVector = new ArrayList < TagFileInfo > ( ) ; HashMap < String , FunctionInfo > functionTable = new HashMap < String , FunctionInfo > ( ) ; // Create an iterator over the child elements of our <taglib> element ParserUtils pu = new ParserUtils ( ) ; TreeNode tld = pu . parseXMLDocument ( uri , in ) ; // Check to see if the <taglib> root element contains a 'version' // attribute, which was added in JSP 2.0 to replace the <jsp-version> // subelement this . jspversion = tld . findAttribute ( "version" ) ; // Process each child element of our <taglib> element Iterator list = tld . findChildren ( ) ; while ( list . hasNext ( ) ) { TreeNode element = ( TreeNode ) list . next ( ) ; String tname = element . getName ( ) ; if ( "tlibversion" . equals ( tname ) // JSP 1.1 || "tlib-version" . equals ( tname ) ) { // JSP 1.2 this . tlibversion = element . getBody ( ) ; } else if ( "jspversion" . equals ( tname ) || "jsp-version" . equals ( tname ) ) { this . jspversion = element . getBody ( ) ; } else if ( "shortname" . equals ( tname ) || "short-name" . equals ( tname ) ) this . shortname = element . getBody ( ) ; else if ( "uri" . equals ( tname ) ) this . urn = element . getBody ( ) ; else if ( "info" . equals ( tname ) || "description" . equals ( tname ) ) this . info = element . getBody ( ) ; else if ( "validator" . equals ( tname ) ) this . tagLibraryValidator = createValidator ( element ) ; else if ( "tag" . equals ( tname ) ) tagVector . add ( createTagInfo ( element , jspversion ) ) ; else if ( "tag-file" . equals ( tname ) ) { TagFileInfo tagFileInfo = createTagFileInfo ( element , uri , jarFileUrl ) ; tagFileVector . add ( tagFileInfo ) ; } else if ( "function" . equals ( tname ) ) { // JSP2.0 FunctionInfo funcInfo = createFunctionInfo ( element ) ; String funcName = funcInfo . getName ( ) ; if ( functionTable . containsKey ( funcName ) ) { err . jspError ( "jsp.error.tld.fn.duplicate.name" , funcName , uri ) ; } functionTable . put ( funcName , funcInfo ) ; } else if ( "display-name" . equals ( tname ) || // Ignored elements "small-icon" . equals ( tname ) || "large-icon" . equals ( tname ) || "listener" . equals ( tname ) ) { ; } else if ( "taglib-extension" . equals ( tname ) ) { // Recognized but ignored } else { err . jspError ( "jsp.error.unknown.element.in.taglib" , tname ) ; } } if ( tlibversion == null ) { err . jspError ( "jsp.error.tld.mandatory.element.missing" , "tlib-version" ) ; } if ( jspversion == null ) { err . jspError ( "jsp.error.tld.mandatory.element.missing" , "jsp-version" ) ; } this . tags = tagVector . toArray ( new TagInfo [ 0 ] ) ; this . tagFiles = tagFileVector . toArray ( new TagFileInfo [ 0 ] ) ; this . functions = new FunctionInfo [ functionTable . size ( ) ] ; int i = 0 ; for ( FunctionInfo funcInfo : functionTable . values ( ) ) { this . functions [ i ++ ] = funcInfo ; } }
/*
@param ctxt The JSP compilation context
@param uri The TLD's uri
@param in The TLD's input stream
@param jarFileUrl The JAR file containing the TLD, or null if the tag
library is not packaged in a JAR
/ *