(
name: string,
line: number,
column: number,
offset: number,
)
| 484 | } |
| 485 | |
| 486 | onEndTag( |
| 487 | name: string, |
| 488 | line: number, |
| 489 | column: number, |
| 490 | offset: number, |
| 491 | ): void { |
| 492 | const expected = this.#elementStack.pop(); |
| 493 | if (expected === undefined) { |
| 494 | throw new XmlSyntaxError( |
| 495 | `Unexpected closing tag </${name}> with no matching opening tag`, |
| 496 | { line, column, offset }, |
| 497 | ); |
| 498 | } |
| 499 | if (expected.rawName !== name) { |
| 500 | throw new XmlSyntaxError( |
| 501 | `Mismatched closing tag: expected </${expected.rawName}> but found </${name}>`, |
| 502 | { line, column, offset }, |
| 503 | ); |
| 504 | } |
| 505 | |
| 506 | // Restore namespace bindings from this element's scope |
| 507 | const elementBindings = this.#nsStack.pop(); |
| 508 | if (elementBindings && this.#nsBindings) { |
| 509 | for (const [prefix, previousUri] of elementBindings) { |
| 510 | if (previousUri === undefined) { |
| 511 | this.#nsBindings.delete(prefix); |
| 512 | } else { |
| 513 | this.#nsBindings.set(prefix, previousUri); |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | this.#callbacks.onEndElement?.( |
| 519 | name, |
| 520 | expected.colonIndex, |
| 521 | expected.uri, |
| 522 | line, |
| 523 | column, |
| 524 | offset, |
| 525 | ); |
| 526 | |
| 527 | // Track when root element closes |
| 528 | if (this.#elementStack.length === 0 && this.#hasRoot) { |
| 529 | this.#rootClosed = true; |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | onText( |
| 534 | content: string, |
nothing calls this directly
no test coverage detected