Attribute ::= Name S? Eq S? ( '"<%=' RTAttributeValueDouble | '"' AttributeValueDouble | "'<%=" RTAttributeValueSingle | "'" AttributeValueSingle } 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.
(AttributesImpl attrs)
| 183 | * and with other xml parsers. |
| 184 | */ |
| 185 | private boolean parseAttribute(AttributesImpl attrs) throws JasperException { |
| 186 | |
| 187 | // Get the qualified name |
| 188 | String qName = parseName(); |
| 189 | if (qName == null) { |
| 190 | return false; |
| 191 | } |
| 192 | |
| 193 | boolean ignoreEL = pageInfo.isELIgnored(); |
| 194 | |
| 195 | // Determine prefix and local name components |
| 196 | String localName = qName; |
| 197 | String uri = ""; |
| 198 | int index = qName.indexOf(':'); |
| 199 | if (index != -1) { |
| 200 | String prefix = qName.substring(0, index); |
| 201 | uri = pageInfo.getURI(prefix); |
| 202 | if (uri == null) { |
| 203 | err.jspError(reader.mark(), "jsp.error.attribute.invalidPrefix", prefix); |
| 204 | } |
| 205 | localName = qName.substring(index + 1); |
| 206 | } |
| 207 | |
| 208 | reader.skipSpaces(); |
| 209 | if (!reader.matches("=")) { |
| 210 | err.jspError(reader.mark(), "jsp.error.attribute.noequal"); |
| 211 | } |
| 212 | |
| 213 | reader.skipSpaces(); |
| 214 | char quote = (char) reader.nextChar(); |
| 215 | if (quote != '\'' && quote != '"') { |
| 216 | err.jspError(reader.mark(), "jsp.error.attribute.noquote"); |
| 217 | } |
| 218 | |
| 219 | String watchString = ""; |
| 220 | if (reader.matches("<%=")) { |
| 221 | watchString = "%>"; |
| 222 | // Can't embed EL in a script expression |
| 223 | ignoreEL = true; |
| 224 | } |
| 225 | watchString = watchString + quote; |
| 226 | |
| 227 | String attrValue = parseAttributeValue(qName, watchString, ignoreEL); |
| 228 | attrs.addAttribute(uri, localName, qName, "CDATA", attrValue); |
| 229 | return true; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Name ::= (Letter | '_' | ':') (Letter | Digit | '.' | '_' | '-' | ':')* |
no test coverage detected