XmlEventCallbacks

import { XmlEventCallbacks } from "jsr:@ende/xml";

interface

interface XmlEventCallbacks

Callbacks for event-level output - enables zero-allocation event emission.

The parser invokes these callbacks instead of creating event objects.

reference

XmlEventCallbacks

Properties

onDeclaration

onDeclaration?: XmlDeclarationCallback

Called for XML declarations.

onDoctype

onDoctype?: XmlDoctypeCallback

Called for DOCTYPE declarations.

Only invoked when the BaseParseOptions.disallowDoctype option is set to false; with the default (true), a DOCTYPE declaration throws an XmlSyntaxError instead.

onText

onText?: XmlContentCallback

Called for text content (entity-decoded).

onCData

onCData?: XmlContentCallback

Called for CDATA sections.

onComment

onComment?: XmlContentCallback

Called for comments.

onProcessingInstruction

onProcessingInstruction?: XmlProcessingInstructionCallback

Called for processing instructions.

Methods

onStartElement

onStartElement?(name: string, colonIndex: number, uri: string | undefined, attributes: XmlAttributeIterator, selfClosing: boolean, line: number, column: number, offset: number): void

Called when an element starts.

name: string
colonIndex: number

Index of ':' in name, or -1 if no prefix.

uri: string | undefined

The resolved namespace URI if the element has a bound prefix, undefined otherwise.

attributes: XmlAttributeIterator
selfClosing: boolean
line: number
column: number
offset: number

onEndElement

onEndElement?(name: string, colonIndex: number, uri: string | undefined, line: number, column: number, offset: number): void

Called when an element ends.

name: string
colonIndex: number

Index of ':' in name, or -1 if no prefix.

uri: string | undefined

The resolved namespace URI if the element has a bound prefix, undefined otherwise.

line: number
column: number
offset: number

Source