bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Parser.java
private void parseXMLTemplateText(Node parent) throws JasperException {
        reader.skipSpaces();
        if( !reader.matches( "/>" ) ) {
            if( !reader.matches( ">" ) ) {
                err.jspError(start, "jsp.error.unterminated",
                    "&lt;jsp:text&gt;" );
            }
            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, (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",
                    "&lt;jsp:text&gt;" );
	    } else if( !reader.matchesETagWithoutLessThan( "jsp:text" ) ) {
                err.jspError( start, "jsp.error.jsptext.badcontent");
            }
        }
    }
private void parseXMLTemplateText(Node parent) throws JasperException {
        reader.skipSpaces();
        if( !reader.matches( "/>" ) ) {
            if( !reader.matches( ">" ) ) {
                err.jspError(start, "jsp.error.unterminated",
                    "&lt;jsp:text&gt;" );
            }
            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, (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",
                    "&lt;jsp:text&gt;" );
	    } else if( !reader.matchesETagWithoutLessThan( "jsp:text" ) ) {
                err.jspError( start, "jsp.error.jsptext.badcontent");
            }
        }
    }
private void parseXMLTemplateText ( Node parent ) throws JasperException { reader . skipSpaces ( ) ; if ( ! reader . matches ( "/>" ) ) { if ( ! reader . matches ( ">" ) ) { err . jspError ( start , "jsp.error.unterminated" , "&lt;jsp:text&gt;" ) ; } 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 , ( 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" , "&lt;jsp:text&gt;" ) ; } else if ( ! reader . matchesETagWithoutLessThan ( "jsp:text" ) ) { err . jspError ( start , "jsp.error.jsptext.badcontent" ) ; } } }
/*
XMLTemplateText ::=   ( S? '/>' )
| ( S? '>'
( ( Char* - ( Char* ( '<' | '${' ) ) )
( '${' ELExpressionBody )?
CDSect?
)* ETag
)
| <TRANSLATION_ERROR>
/ * XMLTemplateText :: = ( S? / > ) | ( S? > ( ( Char * - ( Char * ( < | $ { ) ) ) ( $ { ELExpressionBody ) ? CDSect? ) * ETag ) | <TRANSLATION_ERROR >