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

Method parseXMLTemplateText

java/org/apache/jasper/compiler/Parser.java:1202–1262  ·  view source on GitHub ↗
(Node parent)

Source from the content-addressed store, hash-verified

1200 * CDSect? )* ETag ) | <TRANSLATION_ERROR>
1201 */
1202 private void parseXMLTemplateText(Node parent) throws JasperException {
1203 reader.skipSpaces();
1204 if (!reader.matches("/>")) {
1205 if (!reader.matches(">")) {
1206 err.jspError(start, "jsp.error.unterminated", "&lt;jsp:text&gt;");
1207 }
1208 CharArrayWriter ttext = new CharArrayWriter();
1209 int ch = reader.nextChar();
1210 while (ch != -1) {
1211 if (ch == '<') {
1212 // Check for <![CDATA[
1213 if (!reader.matches("![CDATA[")) {
1214 break;
1215 }
1216 start = reader.mark();
1217 Mark stop = reader.skipUntil("]]>");
1218 if (stop == null) {
1219 err.jspError(start, "jsp.error.unterminated", "CDATA");
1220 }
1221 String text = reader.getText(start, stop);
1222 ttext.write(text, 0, text.length());
1223 } else if (ch == '\\') {
1224 int next = reader.peekChar(0);
1225 if (next == '$' || next == '#') {
1226 ttext.write(reader.nextChar());
1227 } else {
1228 ttext.write('\\');
1229 }
1230 } else if (ch == '$' || ch == '#') {
1231 if (reader.peekChar(0) == '{') {
1232 // Swallow the '{'
1233 reader.nextChar();
1234
1235 // Create a template text node
1236 @SuppressWarnings("unused")
1237 Node unused = new Node.TemplateText(ttext.toString(), start, parent);
1238
1239 // Mark and parse the EL expression and create its node:
1240 parseELExpression(parent, (char) ch);
1241
1242 start = reader.mark();
1243 ttext.reset();
1244 } else {
1245 ttext.write(ch);
1246 }
1247 } else {
1248 ttext.write(ch);
1249 }
1250 ch = reader.nextChar();
1251 }
1252
1253 @SuppressWarnings("unused")
1254 Node unused = new Node.TemplateText(ttext.toString(), start, parent);
1255
1256 if (!reader.hasMoreInput()) {
1257 err.jspError(start, "jsp.error.unterminated", "&lt;jsp:text&gt;");
1258 } else if (!reader.matchesETagWithoutLessThan("jsp:text")) {
1259 err.jspError(start, "jsp.error.jsptext.badcontent");

Callers 2

parseElementsMethod · 0.95

Calls 15

parseELExpressionMethod · 0.95
lengthMethod · 0.80
peekCharMethod · 0.80
hasMoreInputMethod · 0.80
matchesMethod · 0.65
jspErrorMethod · 0.65
writeMethod · 0.65
toStringMethod · 0.65
resetMethod · 0.65
skipSpacesMethod · 0.45
nextCharMethod · 0.45

Tested by

no test coverage detected