HtmlLexicalAnalyzer.ReadDynamicContent C# (CSharp) Method

ReadDynamicContent() private method

skips dynamic content starting with ''
private ReadDynamicContent ( ) : void
return void
    private void ReadDynamicContent()
    {
        // verify that we are at dynamic content, which may include CDATA
        Debug.Assert(_previousCharacter == '<' && _nextCharacter == '!' && _lookAheadCharacter == '[');

        // Let's treat this as empty text
        _nextTokenType = HtmlTokenType.Text;
        _nextToken.Length = 0;

        // advance twice, once to get the lookahead character and then to reach the start of the cdata
        this.GetNextCharacter();
        this.GetNextCharacter();

        // NOTE: 10/12/2004: modified this function to check when called if's reading CDATA or something else
        // some directives may start with a <![ and then have some data and they will just end with a ]>
        // this function is modified to stop at the sequence ]> and not ]]>
        // this means that CDATA and anything else expressed in their own set of [] within the <! [...]>
        // directive cannot contain a ]> sequence. However it is doubtful that cdata could contain such
        // sequence anyway, it probably stops at the first ]
        while (!(_nextCharacter == ']' && _lookAheadCharacter == '>') && !this.IsAtEndOfStream)
        {
            // advance
            this.GetNextCharacter();
        }

        if (!this.IsAtEndOfStream)
        {
            // advance, first to the last >
            this.GetNextCharacter();

            // then advance past it to the next character after processing directive
            this.GetNextCharacter();
        }
    }