MCPcopy Create free account
hub / github.com/denoland/std / onCData

Method onCData

xml/_parser.ts:578–603  ·  view source on GitHub ↗
(
    content: string,
    line: number,
    column: number,
    offset: number,
  )

Source from the content-addressed store, hash-verified

576 }
577
578 onCData(
579 content: string,
580 line: number,
581 column: number,
582 offset: number,
583 ): void {
584 // XML 1.0 §2.8: CDATA sections are only allowed within elements
585 if (!this.#hasRoot) {
586 throw new XmlSyntaxError(
587 "Cannot have CDATA section before the root element (XML 1.0 §2.8)",
588 { line, column, offset },
589 );
590 }
591 if (this.#rootClosed) {
592 throw new XmlSyntaxError(
593 "Cannot have CDATA section after the root element (XML 1.0 §2.8)",
594 { line, column, offset },
595 );
596 }
597
598 if (this.#coerceCDataToText) {
599 this.#callbacks.onText?.(content, line, column, offset);
600 } else {
601 this.#callbacks.onCData?.(content, line, column, offset);
602 }
603 }
604
605 onComment(
606 content: string,

Callers 2

#captureCDATAMethod · 0.80
processMethod · 0.80

Calls 1

onTextMethod · 0.80

Tested by

no test coverage detected