MCPcopy Index your code
hub / github.com/apache/tomcat / parseAttribute

Method parseAttribute

java/org/apache/jasper/compiler/Parser.java:185–230  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 | '.' | '_' | '-' | ':')*

Callers 1

parseAttributesMethod · 0.95

Calls 11

parseNameMethod · 0.95
parseAttributeValueMethod · 0.95
getURIMethod · 0.65
jspErrorMethod · 0.65
matchesMethod · 0.65
isELIgnoredMethod · 0.45
indexOfMethod · 0.45
markMethod · 0.45
skipSpacesMethod · 0.45
nextCharMethod · 0.45
addAttributeMethod · 0.45

Tested by

no test coverage detected