src/lib/Parser.js
/**
  Consumes character data if possible.

  @returns {boolean}
    Whether character data was consumed.

  @see https://www.w3.org/TR/2008/REC-xml-20081126/#dt-chardata
  */
Consumes character data if possible.
Consumes character data if possible .
consumeCharData() {
    let { scanner } = this;
    let charData = scanner.consumeUntilMatch(/<|&|]]>/g);
    if (!charData) {
      return false;
    }
    this.validateChars(charData);
    if (scanner.peek() === ']' && scanner.peek(3) === ']]>') {
      this.error('Element content may not contain the CDATA section close delimiter `]]>`');
    }
    this.addText(charData);
    return true;
  }
consumeCharData ( ) { let { scanner } = this ; let charData = scanner . consumeUntilMatch ( / <|&|]]> / g ) ; if ( ! charData ) { return false ; } this . validateChars ( charData ) ; if ( scanner . peek ( ) === ']' && scanner . peek ( 3 ) === ']]>' ) { this . error ( 'Element content may not contain the CDATA section close delimiter `]]>`' ) ; } this . addText ( charData ) ; return true ; }
Consumes character data if possible.
Consumes character data if possible .