(
content: string,
line: number,
column: number,
offset: number,
)
| 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, |
no test coverage detected