| 457 | * directly with primitive values. |
| 458 | */ |
| 459 | export interface XmlTokenCallbacks { |
| 460 | /** Called when a start tag opens (e.g., `<element`). */ |
| 461 | onStartTagOpen?( |
| 462 | name: string, |
| 463 | line: number, |
| 464 | column: number, |
| 465 | offset: number, |
| 466 | ): void; |
| 467 | |
| 468 | /** Called for each attribute in a start tag. */ |
| 469 | onAttribute?(name: string, value: string): void; |
| 470 | |
| 471 | /** Called when a start tag closes (e.g., `>` or `/>`). */ |
| 472 | onStartTagClose?(selfClosing: boolean): void; |
| 473 | |
| 474 | /** Called when an end tag is encountered (e.g., `</element>`). */ |
| 475 | onEndTag?(name: string, line: number, column: number, offset: number): void; |
| 476 | |
| 477 | /** Called for text content between tags. */ |
| 478 | onText?: XmlContentCallback; |
| 479 | |
| 480 | /** Called for CDATA sections. */ |
| 481 | onCData?: XmlContentCallback; |
| 482 | |
| 483 | /** Called for XML comments. */ |
| 484 | onComment?: XmlContentCallback; |
| 485 | |
| 486 | /** Called for processing instructions. */ |
| 487 | onProcessingInstruction?: XmlProcessingInstructionCallback; |
| 488 | |
| 489 | /** Called for XML declarations. */ |
| 490 | onDeclaration?: XmlDeclarationCallback; |
| 491 | |
| 492 | /** Called for DOCTYPE declarations. */ |
| 493 | onDoctype?: XmlDoctypeCallback; |
| 494 | |
| 495 | /** Called for internal entity declarations in the DTD. */ |
| 496 | onEntityDeclaration?(name: string, value: string): void; |
| 497 | } |
| 498 | |
| 499 | /** |
| 500 | * Reusable attribute accessor that avoids allocating XmlAttribute arrays. |