in src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/Parser.java [1329:1394]
private void parseXMLTemplateText(Node parent) throws JasperException {
reader.skipSpaces();
if (!reader.matches("/>")) {
if (!reader.matches(">")) {
err.jspError(start, "jsp.error.unterminated",
"<jsp:text>");
}
CharArrayWriter ttext = new CharArrayWriter();
while (reader.hasMoreInput()) {
int ch = reader.nextChar();
if (ch == '<') {
// Check for <![CDATA[
if (!reader.matches("![CDATA[")) {
break;
}
start = reader.mark();
Mark stop = reader.skipUntil("]]>");
if (stop == null) {
err.jspError(start, "jsp.error.unterminated", "CDATA");
}
String text = reader.getText(start, stop);
ttext.write(text, 0, text.length());
} else if (ch == '\\') {
if (!reader.hasMoreInput()) {
ttext.write('\\');
break;
}
ch = reader.nextChar();
if (ch != '$' && ch != '#') {
ttext.write('\\');
}
ttext.write(ch);
} else if (ch == '$' || ch == '#') {
if (!reader.hasMoreInput()) {
ttext.write(ch);
break;
}
if (reader.nextChar() != '{') {
ttext.write(ch);
reader.pushChar();
continue;
}
// Create a template text node
new Node.TemplateText(ttext.toString(), start, parent);
// Mark and parse the EL expression and create its node:
start = reader.mark();
parseELExpression(parent, (char) ch);
start = reader.mark();
ttext = new CharArrayWriter();
} else {
ttext.write(ch);
}
}
new Node.TemplateText(ttext.toString(), start, parent);
if (!reader.hasMoreInput()) {
err.jspError(start, "jsp.error.unterminated",
"<jsp:text>");
} else if (!reader.matchesETagWithoutLessThan("jsp:text")) {
err.jspError(start, "jsp.error.jsptext.badcontent");
}
}
}