src/lib/Parser.js
/**
  Consumes a CDATA section if possible.

  @returns {boolean}
    Whether a CDATA section was consumed.

  @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-cdata-sect
  */
Consumes a CDATA section if possible.
Consumes a CDATA section if possible .
consumeCdataSection() {
    let { scanner } = this;
    if (!scanner.consumeStringFast('<![CDATA[')) {
      return false;
    }
    let text = scanner.consumeUntilString(']]>');
    this.validateChars(text);
    if (!scanner.consumeStringFast(']]>')) {
      this.error('Unclosed CDATA section');
    }
    if (this.options.preserveCdata) {
      this.addNode(new XmlCdata(text));
    } else {
      this.addText(text);
    }
    return true;
  }
consumeCdataSection ( ) { let { scanner } = this ; if ( ! scanner . consumeStringFast ( '<![CDATA[' ) ) { return false ; } let text = scanner . consumeUntilString ( ']]>' ) ; this . validateChars ( text ) ; if ( ! scanner . consumeStringFast ( ']]>' ) ) { this . error ( 'Unclosed CDATA section' ) ; } if ( this . options . preserveCdata ) { this . addNode ( new XmlCdata ( text ) ) ; } else { this . addText ( text ) ; } return true ; }
Consumes a CDATA section if possible.
Consumes a CDATA section if possible .