luehe 2002/12/09 13:51:57 Modified: jasper2/src/share/org/apache/jasper/compiler Parser.java Log: Standard syntax: - Added uri and local name to custom action attributes. - Enforce restriction that if a dynamic attribute has a prefix that doesn't map to a namespace (taglib), a translation error is caused. Revision Changes Path 1.42 +26 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Parser.java 5 Dec 2002 17:56:43 -0000 1.41 +++ Parser.java 9 Dec 2002 21:51:56 -0000 1.42 @@ -199,11 +199,29 @@ * Note: JSP and XML spec does not allow while spaces around Eq. It is * added to be backward compatible with Tomcat, and with other xml parsers. */ - private boolean parseAttribute(AttributesImpl attrs) throws JasperException { - String name = parseName(); - if (name == null) + private boolean parseAttribute(AttributesImpl attrs) + throws JasperException { + + // Get the qualified name + String qName = parseName(); + if (qName == null) return false; + // Determine prefix and local name components + String localName = qName; + String uri = ""; + int index = qName.indexOf(':'); + if (index != -1) { + String prefix = qName.substring(0, index); + TagLibraryInfo tagLibInfo = (TagLibraryInfo) taglibs.get(prefix); + if (tagLibInfo == null) { + err.jspError(reader.mark(), + "jsp.error.attribute.invalidPrefix", prefix); + } + uri = tagLibInfo.getURI(); + localName = qName.substring(index+1); + } + reader.skipSpaces(); if (!reader.matches("=")) err.jspError(reader.mark(), "jsp.error.attribute.noequal"); @@ -218,8 +236,8 @@ watchString = "%>"; watchString = watchString + quote; - String attr = parseAttributeValue(watchString); - attrs.addAttribute("", name, name, "CDATA", attr); + String attrValue = parseAttributeValue(watchString); + attrs.addAttribute(uri, localName, qName, "CDATA", attrValue); return true; }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>