stax-xml
stax-xml
stax-xml
Section titled “stax-xml”Classes
Section titled “Classes”EventReader
Section titled “EventReader”Defined in: async/EventReader.ts:13
Async iterator that yields stable, materialized XML event objects.
Use StreamReader instead when current-token access and lower allocation are
more important than retaining event objects.
Implements
Section titled “Implements”AsyncIterable<AnyXmlEvent>AsyncIterator<AnyXmlEvent>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventReader(
input,options?):EventReader
Defined in: async/EventReader.ts:15
Parameters
Section titled “Parameters”options?
Section titled “options?”EventReaderOptions = {}
Returns
Section titled “Returns”Methods
Section titled “Methods”[asyncIterator]()
Section titled “[asyncIterator]()”[asyncIterator]():
AsyncIterator<AnyXmlEvent>
Defined in: async/EventReader.ts:17
Return this reader as its async iterator.
Returns
Section titled “Returns”AsyncIterator<AnyXmlEvent>
Implementation of
Section titled “Implementation of”AsyncIterable.[asyncIterator]
next()
Section titled “next()”next():
Promise<IteratorResult<AnyXmlEvent,any>>
Defined in: async/EventReader.ts:19
Read the next materialized event.
Returns
Section titled “Returns”Promise<IteratorResult<AnyXmlEvent, any>>
Implementation of
Section titled “Implementation of”AsyncIterator.next
close()
Section titled “close()”close():
Promise<void>
Defined in: async/EventReader.ts:21
Stop parsing and close the underlying input iterator.
Returns
Section titled “Returns”Promise<void>
return()
Section titled “return()”return():
Promise<IteratorResult<AnyXmlEvent,any>>
Defined in: async/EventReader.ts:23
Close the reader when async iteration ends early.
Returns
Section titled “Returns”Promise<IteratorResult<AnyXmlEvent, any>>
Implementation of
Section titled “Implementation of”AsyncIterator.return
StreamReader
Section titled “StreamReader”Defined in: async/StreamReader.ts:31
Asynchronous, forward-only XML reader backed by a reusable token cursor.
Call next() before accessing the current token through the accessor methods.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StreamReader(
source,options?):StreamReader
Defined in: async/StreamReader.ts:39
Parameters
Section titled “Parameters”source
Section titled “source”options?
Section titled “options?”StreamReaderOptions = {}
Returns
Section titled “Returns”Methods
Section titled “Methods”next()
Section titled “next()”next():
Promise<XmlEventType|null>
Defined in: async/StreamReader.ts:55
Advance to the next token, or return null at end of input.
Returns
Section titled “Returns”Promise<XmlEventType | null>
close()
Section titled “close()”close():
Promise<void>
Defined in: async/StreamReader.ts:59
Stop parsing and close the underlying input iterator.
Returns
Section titled “Returns”Promise<void>
eventType()
Section titled “eventType()”eventType():
XmlEventType
Defined in: async/StreamReader.ts:63
Return the current token type.
Returns
Section titled “Returns”name()
Section titled “name()”name():
string|undefined
Defined in: async/StreamReader.ts:67
Return the current element’s qualified name.
Returns
Section titled “Returns”string | undefined
text()
Section titled “text()”text():
string|undefined
Defined in: async/StreamReader.ts:71
Return text carried by the current text-like token.
Returns
Section titled “Returns”string | undefined
localName()
Section titled “localName()”localName():
string|undefined
Defined in: async/StreamReader.ts:75
Return the current element’s local name.
Returns
Section titled “Returns”string | undefined
prefix()
Section titled “prefix()”prefix():
string
Defined in: async/StreamReader.ts:79
Return the current element’s namespace prefix, or an empty string.
Returns
Section titled “Returns”string
namespaceURI()
Section titled “namespaceURI()”namespaceURI():
string
Defined in: async/StreamReader.ts:83
Return the namespace URI resolved for the current element.
Returns
Section titled “Returns”string
attributeCount()
Section titled “attributeCount()”attributeCount():
number
Defined in: async/StreamReader.ts:87
Return the number of attributes on the current start element.
Returns
Section titled “Returns”number
attributeName()
Section titled “attributeName()”attributeName(
index):string|undefined
Defined in: async/StreamReader.ts:91
Return an attribute’s qualified name by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributeLocalName()
Section titled “attributeLocalName()”attributeLocalName(
index):string|undefined
Defined in: async/StreamReader.ts:95
Return an attribute’s local name by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributePrefix()
Section titled “attributePrefix()”attributePrefix(
index):string|undefined
Defined in: async/StreamReader.ts:99
Return an attribute’s namespace prefix by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributeNamespaceURI()
Section titled “attributeNamespaceURI()”attributeNamespaceURI(
index):string|undefined
Defined in: async/StreamReader.ts:103
Return an attribute’s namespace URI by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributeValue()
Section titled “attributeValue()”attributeValue(
indexOrNameOrNamespace,localName?):string|undefined
Defined in: async/StreamReader.ts:107
Return an attribute value by index, qualified name, or namespace URI plus local name.
Parameters
Section titled “Parameters”indexOrNameOrNamespace
Section titled “indexOrNameOrNamespace”string | number
localName?
Section titled “localName?”string
Returns
Section titled “Returns”string | undefined
namespaceURIForPrefix()
Section titled “namespaceURIForPrefix()”namespaceURIForPrefix(
prefix):string
Defined in: async/StreamReader.ts:114
Resolve a namespace prefix in the current element scope.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
Returns
Section titled “Returns”string
Writer
Section titled “Writer”Defined in: async/Writer.ts:31
Asynchronous I/O wrapper for the shared WriterCore serializer.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Writer(
output,options?):Writer
Defined in: async/Writer.ts:44
Parameters
Section titled “Parameters”output
Section titled “output”AsyncTextSink | WritableStream<Uint8Array<ArrayBufferLike>>
options?
Section titled “options?”WriterOptions = {}
Returns
Section titled “Returns”Methods
Section titled “Methods”writeStartDocument()
Section titled “writeStartDocument()”writeStartDocument(
version?,encoding?,standalone?):Promise<Writer>
Defined in: async/Writer.ts:87
Write an XML declaration.
Parameters
Section titled “Parameters”version?
Section titled “version?”"1.0" = "1.0"
encoding?
Section titled “encoding?”string
standalone?
Section titled “standalone?”boolean
Returns
Section titled “Returns”Promise<Writer>
writeStartElement()
Section titled “writeStartElement()”writeStartElement(
localName,options?):Promise<Writer>
Defined in: async/Writer.ts:98
Open an element.
Parameters
Section titled “Parameters”localName
Section titled “localName”string
options?
Section titled “options?”Returns
Section titled “Returns”Promise<Writer>
writeEndElement()
Section titled “writeEndElement()”writeEndElement():
Promise<Writer>
Defined in: async/Writer.ts:106
Close the current element.
Returns
Section titled “Returns”Promise<Writer>
writeCharacters()
Section titled “writeCharacters()”writeCharacters(
text):Promise<Writer>
Defined in: async/Writer.ts:111
Write escaped character data.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Writer>
writeCData()
Section titled “writeCData()”writeCData(
cdata):Promise<Writer>
Defined in: async/Writer.ts:116
Write a CDATA section.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Writer>
writeAttribute()
Section titled “writeAttribute()”writeAttribute(
localName,value,prefix?):Promise<Writer>
Defined in: async/Writer.ts:121
Add an attribute to the open start tag.
Parameters
Section titled “Parameters”localName
Section titled “localName”string
string
prefix?
Section titled “prefix?”string
Returns
Section titled “Returns”Promise<Writer>
writeNamespace()
Section titled “writeNamespace()”writeNamespace(
prefix,uri):Promise<Writer>
Defined in: async/Writer.ts:130
Add a namespace declaration to the open start tag.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
string
Returns
Section titled “Returns”Promise<Writer>
writeComment()
Section titled “writeComment()”writeComment(
comment):Promise<Writer>
Defined in: async/Writer.ts:135
Write an XML comment.
Parameters
Section titled “Parameters”comment
Section titled “comment”string
Returns
Section titled “Returns”Promise<Writer>
writeProcessingInstruction()
Section titled “writeProcessingInstruction()”writeProcessingInstruction(
target,data?):Promise<Writer>
Defined in: async/Writer.ts:140
Write a processing instruction.
Parameters
Section titled “Parameters”target
Section titled “target”string
string
Returns
Section titled “Returns”Promise<Writer>
writeDTD()
Section titled “writeDTD()”writeDTD(
value):Promise<Writer>
Defined in: async/Writer.ts:148
Write a document type declaration.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Writer>
writeEvent()
Section titled “writeEvent()”writeEvent(
event):Promise<Writer>
Defined in: async/Writer.ts:153
Write one standard materialized XML event.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<Writer>
writeRaw()
Section titled “writeRaw()”writeRaw(
xml):Promise<Writer>
Defined in: async/Writer.ts:159
Write trusted XML text without escaping.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Writer>
writeEndDocument()
Section titled “writeEndDocument()”writeEndDocument():
Promise<void>
Defined in: async/Writer.ts:165
Finish the XML document and close the output.
Returns
Section titled “Returns”Promise<void>
close()
Section titled “close()”close():
Promise<void>
Defined in: async/Writer.ts:180
Close the writer and its output.
Returns
Section titled “Returns”Promise<void>
flush()
Section titled “flush()”flush():
Promise<void>
Defined in: async/Writer.ts:184
Flush buffered output.
Returns
Section titled “Returns”Promise<void>
EventReaderSync
Section titled “EventReaderSync”Defined in: sync/EventReaderSync.ts:8
Synchronous iterator that yields stable, materialized XML event objects.
Implements
Section titled “Implements”Iterable<AnyXmlEvent>Iterator<AnyXmlEvent>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventReaderSync(
input,options?):EventReaderSync
Defined in: sync/EventReaderSync.ts:11
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<AnyXmlEvent>
Defined in: sync/EventReaderSync.ts:13
Return this reader as its iterator.
Returns
Section titled “Returns”Iterator<AnyXmlEvent>
Implementation of
Section titled “Implementation of”Iterable.[iterator]
next()
Section titled “next()”next():
IteratorResult<AnyXmlEvent>
Defined in: sync/EventReaderSync.ts:15
Read the next materialized event.
Returns
Section titled “Returns”IteratorResult<AnyXmlEvent>
Implementation of
Section titled “Implementation of”Iterator.next
return()
Section titled “return()”return():
IteratorResult<AnyXmlEvent>
Defined in: sync/EventReaderSync.ts:22
Close the reader when iteration ends early.
Returns
Section titled “Returns”IteratorResult<AnyXmlEvent>
Implementation of
Section titled “Implementation of”Iterator.return
close()
Section titled “close()”close():
void
Defined in: sync/EventReaderSync.ts:27
Stop parsing and release the underlying input iterator.
Returns
Section titled “Returns”void
StreamReaderSync
Section titled “StreamReaderSync”Defined in: sync/StreamReaderSync.ts:28
Synchronous current-token reader. Strings are scanned directly without encoding; byte inputs are decoded in fatal mode with the configured encoding.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StreamReaderSync(
input,options?):StreamReaderSync
Defined in: sync/StreamReaderSync.ts:34
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Methods
Section titled “Methods”next()
Section titled “next()”next():
XmlEventType|null
Defined in: sync/StreamReaderSync.ts:63
Advance to the next token, or return null at end of input.
Returns
Section titled “Returns”XmlEventType | null
close()
Section titled “close()”close():
void
Defined in: sync/StreamReaderSync.ts:89
Stop parsing and release the underlying input iterator.
Returns
Section titled “Returns”void
eventType()
Section titled “eventType()”eventType():
XmlEventType
Defined in: sync/StreamReaderSync.ts:98
Return the current token type.
Returns
Section titled “Returns”name()
Section titled “name()”name():
string|undefined
Defined in: sync/StreamReaderSync.ts:102
Return the current element’s qualified name.
Returns
Section titled “Returns”string | undefined
text()
Section titled “text()”text():
string|undefined
Defined in: sync/StreamReaderSync.ts:106
Return text carried by the current text-like token.
Returns
Section titled “Returns”string | undefined
localName()
Section titled “localName()”localName():
string|undefined
Defined in: sync/StreamReaderSync.ts:110
Return the current element’s local name.
Returns
Section titled “Returns”string | undefined
prefix()
Section titled “prefix()”prefix():
string
Defined in: sync/StreamReaderSync.ts:114
Return the current element’s namespace prefix, or an empty string.
Returns
Section titled “Returns”string
namespaceURI()
Section titled “namespaceURI()”namespaceURI():
string
Defined in: sync/StreamReaderSync.ts:118
Return the namespace URI resolved for the current element.
Returns
Section titled “Returns”string
attributeCount()
Section titled “attributeCount()”attributeCount():
number
Defined in: sync/StreamReaderSync.ts:122
Return the number of attributes on the current start element.
Returns
Section titled “Returns”number
attributeName()
Section titled “attributeName()”attributeName(
index):string|undefined
Defined in: sync/StreamReaderSync.ts:126
Return an attribute’s qualified name by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributeLocalName()
Section titled “attributeLocalName()”attributeLocalName(
index):string|undefined
Defined in: sync/StreamReaderSync.ts:130
Return an attribute’s local name by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributePrefix()
Section titled “attributePrefix()”attributePrefix(
index):string|undefined
Defined in: sync/StreamReaderSync.ts:134
Return an attribute’s namespace prefix by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributeNamespaceURI()
Section titled “attributeNamespaceURI()”attributeNamespaceURI(
index):string|undefined
Defined in: sync/StreamReaderSync.ts:138
Return an attribute’s namespace URI by zero-based index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributeValue()
Section titled “attributeValue()”attributeValue(
indexOrNameOrNamespace,localName?):string|undefined
Defined in: sync/StreamReaderSync.ts:142
Return an attribute value by index, qualified name, or namespace URI plus local name.
Parameters
Section titled “Parameters”indexOrNameOrNamespace
Section titled “indexOrNameOrNamespace”string | number
localName?
Section titled “localName?”string
Returns
Section titled “Returns”string | undefined
namespaceURIForPrefix()
Section titled “namespaceURIForPrefix()”namespaceURIForPrefix(
prefix):string
Defined in: sync/StreamReaderSync.ts:151
Resolve a namespace prefix in the current element scope.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
Returns
Section titled “Returns”string
WriterSync
Section titled “WriterSync”Defined in: sync/WriterSync.ts:35
String-based synchronous XML writer.
Extended by
Section titled “Extended by”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WriterSync(
options?,encoding?):WriterSync
Defined in: sync/WriterSync.ts:39
Parameters
Section titled “Parameters”options?
Section titled “options?”WriterSyncOptions = {}
encoding?
Section titled “encoding?”string = ...
Returns
Section titled “Returns”Methods
Section titled “Methods”getXmlString()
Section titled “getXmlString()”getXmlString():
string
Defined in: sync/WriterSync.ts:48
Return XML accumulated by this string writer.
Returns
Section titled “Returns”string
writeStartDocument()
Section titled “writeStartDocument()”writeStartDocument(
version?,encoding?,standalone?):this
Defined in: sync/WriterSync.ts:56
Write an XML declaration.
Parameters
Section titled “Parameters”version?
Section titled “version?”"1.0" = "1.0"
encoding?
Section titled “encoding?”string
standalone?
Section titled “standalone?”boolean
Returns
Section titled “Returns”this
writeEndDocument()
Section titled “writeEndDocument()”writeEndDocument():
void
Defined in: sync/WriterSync.ts:65
Finish the XML document.
Returns
Section titled “Returns”void
writeStartElement()
Section titled “writeStartElement()”writeStartElement(
localName,options?):this
Defined in: sync/WriterSync.ts:69
Open an element.
Parameters
Section titled “Parameters”localName
Section titled “localName”string
options?
Section titled “options?”Returns
Section titled “Returns”this
writeEndElement()
Section titled “writeEndElement()”writeEndElement():
this
Defined in: sync/WriterSync.ts:77
Close the current element.
Returns
Section titled “Returns”this
writeCharacters()
Section titled “writeCharacters()”writeCharacters(
text):this
Defined in: sync/WriterSync.ts:82
Write escaped character data.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
writeCData()
Section titled “writeCData()”writeCData(
cdata):this
Defined in: sync/WriterSync.ts:87
Write a CDATA section.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
writeAttribute()
Section titled “writeAttribute()”writeAttribute(
localName,value,prefix?):this
Defined in: sync/WriterSync.ts:92
Add an attribute to the open start tag.
Parameters
Section titled “Parameters”localName
Section titled “localName”string
string
prefix?
Section titled “prefix?”string
Returns
Section titled “Returns”this
writeNamespace()
Section titled “writeNamespace()”writeNamespace(
prefix,uri):this
Defined in: sync/WriterSync.ts:101
Add a namespace declaration to the open start tag.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
string
Returns
Section titled “Returns”this
writeComment()
Section titled “writeComment()”writeComment(
comment):this
Defined in: sync/WriterSync.ts:106
Write an XML comment.
Parameters
Section titled “Parameters”comment
Section titled “comment”string
Returns
Section titled “Returns”this
writeProcessingInstruction()
Section titled “writeProcessingInstruction()”writeProcessingInstruction(
target,data?):this
Defined in: sync/WriterSync.ts:111
Write a processing instruction.
Parameters
Section titled “Parameters”target
Section titled “target”string
string
Returns
Section titled “Returns”this
writeDTD()
Section titled “writeDTD()”writeDTD(
value):this
Defined in: sync/WriterSync.ts:116
Write a document type declaration.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
writeEvent()
Section titled “writeEvent()”writeEvent(
event):this
Defined in: sync/WriterSync.ts:121
Write one standard materialized XML event.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
writeRaw()
Section titled “writeRaw()”writeRaw(
xml):this
Defined in: sync/WriterSync.ts:127
Write trusted XML text without escaping.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
setPrettyPrint()
Section titled “setPrettyPrint()”setPrettyPrint(
enabled):this
Defined in: sync/WriterSync.ts:132
Enable or disable pretty printing.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”this
setIndentString()
Section titled “setIndentString()”setIndentString(
indentString):this
Defined in: sync/WriterSync.ts:137
Set the indentation unit used by pretty printing.
Parameters
Section titled “Parameters”indentString
Section titled “indentString”string
Returns
Section titled “Returns”this
isPrettyPrintEnabled()
Section titled “isPrettyPrintEnabled()”isPrettyPrintEnabled():
boolean
Defined in: sync/WriterSync.ts:142
Return whether pretty printing is enabled.
Returns
Section titled “Returns”boolean
getIndentString()
Section titled “getIndentString()”getIndentString():
string
Defined in: sync/WriterSync.ts:146
Return the current indentation unit.
Returns
Section titled “Returns”string
WriterSyncSink
Section titled “WriterSyncSink”Defined in: sync/WriterSync.ts:152
Sink-based sync writer. I/O and flushing live here, outside WriterCore.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WriterSyncSink(
sink,options?):WriterSyncSink
Defined in: sync/WriterSync.ts:159
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Overrides
Section titled “Overrides”Methods
Section titled “Methods”getXmlString()
Section titled “getXmlString()”getXmlString():
string
Defined in: sync/WriterSync.ts:48
Return XML accumulated by this string writer.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”writeStartDocument()
Section titled “writeStartDocument()”writeStartDocument(
version?,encoding?,standalone?):this
Defined in: sync/WriterSync.ts:56
Write an XML declaration.
Parameters
Section titled “Parameters”version?
Section titled “version?”"1.0" = "1.0"
encoding?
Section titled “encoding?”string
standalone?
Section titled “standalone?”boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeStartElement()
Section titled “writeStartElement()”writeStartElement(
localName,options?):this
Defined in: sync/WriterSync.ts:69
Open an element.
Parameters
Section titled “Parameters”localName
Section titled “localName”string
options?
Section titled “options?”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeEndElement()
Section titled “writeEndElement()”writeEndElement():
this
Defined in: sync/WriterSync.ts:77
Close the current element.
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeCharacters()
Section titled “writeCharacters()”writeCharacters(
text):this
Defined in: sync/WriterSync.ts:82
Write escaped character data.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeCData()
Section titled “writeCData()”writeCData(
cdata):this
Defined in: sync/WriterSync.ts:87
Write a CDATA section.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeAttribute()
Section titled “writeAttribute()”writeAttribute(
localName,value,prefix?):this
Defined in: sync/WriterSync.ts:92
Add an attribute to the open start tag.
Parameters
Section titled “Parameters”localName
Section titled “localName”string
string
prefix?
Section titled “prefix?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeNamespace()
Section titled “writeNamespace()”writeNamespace(
prefix,uri):this
Defined in: sync/WriterSync.ts:101
Add a namespace declaration to the open start tag.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeComment()
Section titled “writeComment()”writeComment(
comment):this
Defined in: sync/WriterSync.ts:106
Write an XML comment.
Parameters
Section titled “Parameters”comment
Section titled “comment”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeProcessingInstruction()
Section titled “writeProcessingInstruction()”writeProcessingInstruction(
target,data?):this
Defined in: sync/WriterSync.ts:111
Write a processing instruction.
Parameters
Section titled “Parameters”target
Section titled “target”string
string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”WriterSync.writeProcessingInstruction
writeDTD()
Section titled “writeDTD()”writeDTD(
value):this
Defined in: sync/WriterSync.ts:116
Write a document type declaration.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeEvent()
Section titled “writeEvent()”writeEvent(
event):this
Defined in: sync/WriterSync.ts:121
Write one standard materialized XML event.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”writeRaw()
Section titled “writeRaw()”writeRaw(
xml):this
Defined in: sync/WriterSync.ts:127
Write trusted XML text without escaping.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”setPrettyPrint()
Section titled “setPrettyPrint()”setPrettyPrint(
enabled):this
Defined in: sync/WriterSync.ts:132
Enable or disable pretty printing.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”setIndentString()
Section titled “setIndentString()”setIndentString(
indentString):this
Defined in: sync/WriterSync.ts:137
Set the indentation unit used by pretty printing.
Parameters
Section titled “Parameters”indentString
Section titled “indentString”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”isPrettyPrintEnabled()
Section titled “isPrettyPrintEnabled()”isPrettyPrintEnabled():
boolean
Defined in: sync/WriterSync.ts:142
Return whether pretty printing is enabled.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”WriterSync.isPrettyPrintEnabled
getIndentString()
Section titled “getIndentString()”getIndentString():
string
Defined in: sync/WriterSync.ts:146
Return the current indentation unit.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”writeEndDocument()
Section titled “writeEndDocument()”writeEndDocument():
void
Defined in: sync/WriterSync.ts:200
Finish the document and flush serialized text to the sink.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”flush()
Section titled “flush()”flush():
void
Defined in: sync/WriterSync.ts:206
Flush buffered text to the sink.
Returns
Section titled “Returns”void
close()
Section titled “close()”close():
void
Defined in: sync/WriterSync.ts:217
Finalize the document and close the sink.
Returns
Section titled “Returns”void
Interfaces
Section titled “Interfaces”EventReaderOptions
Section titled “EventReaderOptions”Defined in: async/EventReader.ts:5
Options for the asynchronous materialized-event reader.
Extends
Section titled “Extends”Properties
Section titled “Properties”documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: async/StreamReader.ts:16
Inherited from
Section titled “Inherited from”StreamReaderOptions.documentMode
namespaceAware?
Section titled “namespaceAware?”
optionalnamespaceAware?:boolean
Defined in: async/StreamReader.ts:18
Resolve namespaces while retaining xmlns declarations in start-event attributes.
Default Value
Section titled “Default Value”trueInherited from
Section titled “Inherited from”StreamReaderOptions.namespaceAware
autoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: async/StreamReader.ts:20
Decode predefined, numeric, and configured custom entities.
Default Value
Section titled “Default Value”trueInherited from
Section titled “Inherited from”StreamReaderOptions.autoDecodeEntities
addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: async/StreamReader.ts:22
Trusted internal entity replacements available without parsing a DTD.
entity
Section titled “entity”entity:
string
value:
string
Inherited from
Section titled “Inherited from”StreamReaderOptions.addEntities
encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: async/StreamReader.ts:24
TextDecoder encoding label for byte input.
Default Value
Section titled “Default Value”'utf-8'Inherited from
Section titled “Inherited from”StreamReaderOptions
Section titled “StreamReaderOptions”Defined in: async/StreamReader.ts:15
Options for asynchronous current-token parsing.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: async/StreamReader.ts:16
namespaceAware?
Section titled “namespaceAware?”
optionalnamespaceAware?:boolean
Defined in: async/StreamReader.ts:18
Resolve namespaces while retaining xmlns declarations in start-event attributes.
Default Value
Section titled “Default Value”trueautoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: async/StreamReader.ts:20
Decode predefined, numeric, and configured custom entities.
Default Value
Section titled “Default Value”trueaddEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: async/StreamReader.ts:22
Trusted internal entity replacements available without parsing a DTD.
entity
Section titled “entity”entity:
string
value:
string
encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: async/StreamReader.ts:24
TextDecoder encoding label for byte input.
Default Value
Section titled “Default Value”'utf-8'WriterOptions
Section titled “WriterOptions”Defined in: async/Writer.ts:9
Options shared by the asynchronous XML writer and its serializer core.
Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: async/Writer.ts:10
prettyPrint?
Section titled “prettyPrint?”
optionalprettyPrint?:boolean
Defined in: async/Writer.ts:11
indentString?
Section titled “indentString?”
optionalindentString?:string
Defined in: async/Writer.ts:12
addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: async/Writer.ts:13
entity
Section titled “entity”entity:
string
value:
string
autoEncodeEntities?
Section titled “autoEncodeEntities?”
optionalautoEncodeEntities?:boolean
Defined in: async/Writer.ts:14
bufferSize?
Section titled “bufferSize?”
optionalbufferSize?:number
Defined in: async/Writer.ts:15
flushThreshold?
Section titled “flushThreshold?”
optionalflushThreshold?:number
Defined in: async/Writer.ts:16
enableAutoFlush?
Section titled “enableAutoFlush?”
optionalenableAutoFlush?:boolean
Defined in: async/Writer.ts:17
AsyncTextSink
Section titled “AsyncTextSink”Defined in: async/Writer.ts:20
Text sink for external streaming encoders.
Properties
Section titled “Properties”encoding
Section titled “encoding”
readonlyencoding:string
Defined in: async/Writer.ts:21
Methods
Section titled “Methods”write()
Section titled “write()”write(
chunk):void|Promise<void>
Defined in: async/Writer.ts:23
Write a serialized XML text chunk.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void | Promise<void>
flush()?
Section titled “flush()?”
optionalflush():void|Promise<void>
Defined in: async/Writer.ts:25
Flush buffered text when supported.
Returns
Section titled “Returns”void | Promise<void>
close()?
Section titled “close()?”
optionalclose():void|Promise<void>
Defined in: async/Writer.ts:27
Close the sink when supported.
Returns
Section titled “Returns”void | Promise<void>
StartDocumentEvent
Section titled “StartDocumentEvent”Defined in: core/types.ts:25
Event fired when the document starts parsing
Properties
Section titled “Properties”type:
"START_DOCUMENT"
Defined in: core/types.ts:26
version?
Section titled “version?”
optionalversion?:"1.0"
Defined in: core/types.ts:28
Present only when the source contained an XML declaration.
encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: core/types.ts:29
standalone?
Section titled “standalone?”
optionalstandalone?:boolean
Defined in: core/types.ts:30
EndDocumentEvent
Section titled “EndDocumentEvent”Defined in: core/types.ts:38
Event fired when the document ends parsing
Properties
Section titled “Properties”type:
"END_DOCUMENT"
Defined in: core/types.ts:39
StartElementEvent
Section titled “StartElementEvent”Defined in: core/types.ts:47
Event fired when an XML element starts
Properties
Section titled “Properties”type:
"START_ELEMENT"
Defined in: core/types.ts:48
name:
string
Defined in: core/types.ts:49
localName
Section titled “localName”localName:
string
Defined in: core/types.ts:50
prefix
Section titled “prefix”prefix:
string
Defined in: core/types.ts:51
namespaceURI
Section titled “namespaceURI”namespaceURI:
string
Defined in: core/types.ts:52
attributes?
Section titled “attributes?”
optionalattributes?:EventAttributes
Defined in: core/types.ts:54
Attributes in source order, or undefined when the element has none.
selfClosing
Section titled “selfClosing”selfClosing:
boolean
Defined in: core/types.ts:56
Whether the source used an empty-element tag (<element/>).
EventAttribute
Section titled “EventAttribute”Defined in: core/types.ts:60
Materialized attribute attached to a start-element event.
Properties
Section titled “Properties”name:
string
Defined in: core/types.ts:61
localName
Section titled “localName”localName:
string
Defined in: core/types.ts:62
prefix
Section titled “prefix”prefix:
string
Defined in: core/types.ts:63
namespaceURI
Section titled “namespaceURI”namespaceURI:
string
Defined in: core/types.ts:64
value:
string
Defined in: core/types.ts:65
EventAttributes
Section titled “EventAttributes”Defined in: core/types.ts:75
Attribute lookup table keyed by qualified XML name.
Remarks
Section titled “Remarks”Iteration follows source order. JSON.stringify() emits the same object
shape as a record while reserved JavaScript property names remain safe.
Extends
Section titled “Extends”ReadonlyMap<string,EventAttribute>
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON():
Record<string,EventAttribute>
Defined in: core/types.ts:77
Return a qualified-name record for JSON serialization.
Returns
Section titled “Returns”Record<string, EventAttribute>
EndElementEvent
Section titled “EndElementEvent”Defined in: core/types.ts:81
Event emitted when an XML element ends.
Properties
Section titled “Properties”type:
"END_ELEMENT"
Defined in: core/types.ts:82
name:
string
Defined in: core/types.ts:83
localName
Section titled “localName”localName:
string
Defined in: core/types.ts:84
prefix
Section titled “prefix”prefix:
string
Defined in: core/types.ts:85
namespaceURI
Section titled “namespaceURI”namespaceURI:
string
Defined in: core/types.ts:86
CharactersEvent
Section titled “CharactersEvent”Defined in: core/types.ts:90
Event containing ordinary character data.
Properties
Section titled “Properties”type:
"CHARACTERS"
Defined in: core/types.ts:91
value:
string
Defined in: core/types.ts:92
CdataEvent
Section titled “CdataEvent”Defined in: core/types.ts:96
Event containing CDATA content.
Properties
Section titled “Properties”type:
"CDATA"
Defined in: core/types.ts:97
value:
string
Defined in: core/types.ts:98
CommentEvent
Section titled “CommentEvent”Defined in: core/types.ts:102
Event containing an XML comment.
Properties
Section titled “Properties”type:
"COMMENT"
Defined in: core/types.ts:103
value:
string
Defined in: core/types.ts:104
ProcessingInstructionEvent
Section titled “ProcessingInstructionEvent”Defined in: core/types.ts:107
Event containing an XML processing instruction.
Properties
Section titled “Properties”type:
"PROCESSING_INSTRUCTION"
Defined in: core/types.ts:108
target
Section titled “target”target:
string
Defined in: core/types.ts:109
data:
string
Defined in: core/types.ts:110
DtdEvent
Section titled “DtdEvent”Defined in: core/types.ts:113
Event containing a document type declaration.
Properties
Section titled “Properties”type:
"DTD"
Defined in: core/types.ts:114
value:
string
Defined in: core/types.ts:115
AttributeInfo
Section titled “AttributeInfo”Defined in: core/types.ts:135
Attribute information interface
Properties
Section titled “Properties”value:
string
Defined in: core/types.ts:136
prefix?
Section titled “prefix?”
optionalprefix?:string
Defined in: core/types.ts:137
optionaluri?:string
Defined in: core/types.ts:138
WriteElementOptions
Section titled “WriteElementOptions”Defined in: core/types.ts:207
Element writing options interface (for Writer)
Properties
Section titled “Properties”prefix?
Section titled “prefix?”
optionalprefix?:string
Defined in: core/types.ts:208
optionaluri?:string
Defined in: core/types.ts:209
attributes?
Section titled “attributes?”
optionalattributes?:Record<string,string|AttributeInfo>
Defined in: core/types.ts:210
selfClosing?
Section titled “selfClosing?”
optionalselfClosing?:boolean
Defined in: core/types.ts:211
comment?
Section titled “comment?”
optionalcomment?:string
Defined in: core/types.ts:212
EventReaderSyncOptions
Section titled “EventReaderSyncOptions”Defined in: sync/EventReaderSync.ts:5
Options for the synchronous materialized-event reader.
Extends
Section titled “Extends”Properties
Section titled “Properties”documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: sync/StreamReaderSync.ts:12
Inherited from
Section titled “Inherited from”StreamReaderSyncOptions.documentMode
namespaceAware?
Section titled “namespaceAware?”
optionalnamespaceAware?:boolean
Defined in: sync/StreamReaderSync.ts:14
Resolve namespaces while retaining xmlns declarations in start-event attributes.
Default Value
Section titled “Default Value”trueInherited from
Section titled “Inherited from”StreamReaderSyncOptions.namespaceAware
autoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: sync/StreamReaderSync.ts:16
Decode predefined, numeric, and configured custom entities.
Default Value
Section titled “Default Value”trueInherited from
Section titled “Inherited from”StreamReaderSyncOptions.autoDecodeEntities
addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: sync/StreamReaderSync.ts:18
Trusted internal entity replacements available without parsing a DTD.
entity
Section titled “entity”entity:
string
value:
string
Inherited from
Section titled “Inherited from”StreamReaderSyncOptions.addEntities
encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: sync/StreamReaderSync.ts:20
TextDecoder encoding label for byte input.
Default Value
Section titled “Default Value”'utf-8'Inherited from
Section titled “Inherited from”StreamReaderSyncOptions.encoding
StreamReaderSyncOptions
Section titled “StreamReaderSyncOptions”Defined in: sync/StreamReaderSync.ts:11
Options for synchronous current-token parsing.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: sync/StreamReaderSync.ts:12
namespaceAware?
Section titled “namespaceAware?”
optionalnamespaceAware?:boolean
Defined in: sync/StreamReaderSync.ts:14
Resolve namespaces while retaining xmlns declarations in start-event attributes.
Default Value
Section titled “Default Value”trueautoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: sync/StreamReaderSync.ts:16
Decode predefined, numeric, and configured custom entities.
Default Value
Section titled “Default Value”trueaddEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: sync/StreamReaderSync.ts:18
Trusted internal entity replacements available without parsing a DTD.
entity
Section titled “entity”entity:
string
value:
string
encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: sync/StreamReaderSync.ts:20
TextDecoder encoding label for byte input.
Default Value
Section titled “Default Value”'utf-8'SyncTextSink
Section titled “SyncTextSink”Defined in: sync/WriterSync.ts:9
Sink interface for custom sync targets.
Properties
Section titled “Properties”encoding?
Section titled “encoding?”
readonlyoptionalencoding?:string
Defined in: sync/WriterSync.ts:10
Methods
Section titled “Methods”write()
Section titled “write()”write(
chunk):void
Defined in: sync/WriterSync.ts:12
Write a serialized XML text chunk.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
flush()?
Section titled “flush()?”
optionalflush():void
Defined in: sync/WriterSync.ts:14
Flush buffered text when supported.
Returns
Section titled “Returns”void
close()?
Section titled “close()?”
optionalclose():void
Defined in: sync/WriterSync.ts:16
Close the sink when supported.
Returns
Section titled “Returns”void
WriterSyncOptions
Section titled “WriterSyncOptions”Defined in: sync/WriterSync.ts:19
Options for string-based synchronous writing.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: sync/WriterSync.ts:20
prettyPrint?
Section titled “prettyPrint?”
optionalprettyPrint?:boolean
Defined in: sync/WriterSync.ts:21
indentString?
Section titled “indentString?”
optionalindentString?:string
Defined in: sync/WriterSync.ts:22
addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: sync/WriterSync.ts:23
entity
Section titled “entity”entity:
string
value:
string
autoEncodeEntities?
Section titled “autoEncodeEntities?”
optionalautoEncodeEntities?:boolean
Defined in: sync/WriterSync.ts:24
WriterSyncSinkOptions
Section titled “WriterSyncSinkOptions”Defined in: sync/WriterSync.ts:27
Options for incremental synchronous sink writing.
Extends
Section titled “Extends”Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: sync/WriterSync.ts:20
Inherited from
Section titled “Inherited from”prettyPrint?
Section titled “prettyPrint?”
optionalprettyPrint?:boolean
Defined in: sync/WriterSync.ts:21
Inherited from
Section titled “Inherited from”indentString?
Section titled “indentString?”
optionalindentString?:string
Defined in: sync/WriterSync.ts:22
Inherited from
Section titled “Inherited from”WriterSyncOptions.indentString
addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: sync/WriterSync.ts:23
entity
Section titled “entity”entity:
string
value:
string
Inherited from
Section titled “Inherited from”autoEncodeEntities?
Section titled “autoEncodeEntities?”
optionalautoEncodeEntities?:boolean
Defined in: sync/WriterSync.ts:24
Inherited from
Section titled “Inherited from”WriterSyncOptions.autoEncodeEntities
bufferSize?
Section titled “bufferSize?”
optionalbufferSize?:number
Defined in: sync/WriterSync.ts:28
enableAutoFlush?
Section titled “enableAutoFlush?”
optionalenableAutoFlush?:boolean
Defined in: sync/WriterSync.ts:29
flushOnClose?
Section titled “flushOnClose?”
optionalflushOnClose?:boolean
Defined in: sync/WriterSync.ts:30
flushThreshold?
Section titled “flushThreshold?”
optionalflushThreshold?:number
Defined in: sync/WriterSync.ts:31
Type Aliases
Section titled “Type Aliases”StreamReaderSource
Section titled “StreamReaderSource”StreamReaderSource =
AsyncIterable<Uint8Array> |ReadableStream<Uint8Array>
Defined in: async/StreamReader.ts:11
Byte-stream sources accepted by StreamReader.
XmlEventType
Section titled “XmlEventType”XmlEventType = typeof
XmlEventType[keyof typeofXmlEventType]
Defined in: core/types.ts:6
Enumeration of XML stream event types used by the StAX parser
AnyXmlEvent
Section titled “AnyXmlEvent”AnyXmlEvent =
StartDocumentEvent|EndDocumentEvent|StartElementEvent|EndElementEvent|CharactersEvent|CdataEvent|CommentEvent|ProcessingInstructionEvent|DtdEvent
Defined in: core/types.ts:121
Discriminated Union type for developer use
DocumentMode
Section titled “DocumentMode”DocumentMode =
"fragment"|"document"
Defined in: core/types.ts:226
XML document conformance mode.
StreamReaderSyncInput
Section titled “StreamReaderSyncInput”StreamReaderSyncInput =
string|Uint8Array|Iterable<Uint8Array>
Defined in: sync/StreamReaderSync.ts:9
Inputs accepted by StreamReaderSync.
Variables
Section titled “Variables”XmlEventType
Section titled “XmlEventType”
constXmlEventType:object
Defined in: core/types.ts:6
Enumeration of XML stream event types used by the StAX parser
Type Declaration
Section titled “Type Declaration”START_DOCUMENT
Section titled “START_DOCUMENT”
readonlySTART_DOCUMENT:"START_DOCUMENT"="START_DOCUMENT"
END_DOCUMENT
Section titled “END_DOCUMENT”
readonlyEND_DOCUMENT:"END_DOCUMENT"="END_DOCUMENT"
START_ELEMENT
Section titled “START_ELEMENT”
readonlySTART_ELEMENT:"START_ELEMENT"="START_ELEMENT"
END_ELEMENT
Section titled “END_ELEMENT”
readonlyEND_ELEMENT:"END_ELEMENT"="END_ELEMENT"
CHARACTERS
Section titled “CHARACTERS”
readonlyCHARACTERS:"CHARACTERS"="CHARACTERS"
readonlyCDATA:"CDATA"="CDATA"
COMMENT
Section titled “COMMENT”
readonlyCOMMENT:"COMMENT"="COMMENT"
PROCESSING_INSTRUCTION
Section titled “PROCESSING_INSTRUCTION”
readonlyPROCESSING_INSTRUCTION:"PROCESSING_INSTRUCTION"="PROCESSING_INSTRUCTION"
readonlyDTD:"DTD"="DTD"
Functions
Section titled “Functions”isStartElement()
Section titled “isStartElement()”isStartElement(
event):event is StartElementEvent
Defined in: core/types.ts:151
Type guard function - Check if the event is a START_ELEMENT event
Parameters
Section titled “Parameters”XML event to check
Returns
Section titled “Returns”event is StartElementEvent
true if the event is a START_ELEMENT event, false otherwise
isEndElement()
Section titled “isEndElement()”isEndElement(
event):event is EndElementEvent
Defined in: core/types.ts:160
Type guard function - Check if the event is an END_ELEMENT event
Parameters
Section titled “Parameters”XML event to check
Returns
Section titled “Returns”event is EndElementEvent
true if the event is an END_ELEMENT event, false otherwise
isCharacters()
Section titled “isCharacters()”isCharacters(
event):event is CharactersEvent
Defined in: core/types.ts:169
Type guard function - Check if the event is a CHARACTERS event
Parameters
Section titled “Parameters”XML event to check
Returns
Section titled “Returns”event is CharactersEvent
true if the event is a CHARACTERS event, false otherwise
isCdata()
Section titled “isCdata()”isCdata(
event):event is CdataEvent
Defined in: core/types.ts:177
Type guard function - Check if the event is a CDATA event
Parameters
Section titled “Parameters”XML event to check
Returns
Section titled “Returns”event is CdataEvent
true if the event is a CDATA event, false otherwise
isStartDocument()
Section titled “isStartDocument()”isStartDocument(
event):event is StartDocumentEvent
Defined in: core/types.ts:190
Type guard function - Check if the event is a START_DOCUMENT event
Parameters
Section titled “Parameters”XML event to check
Returns
Section titled “Returns”event is StartDocumentEvent
true if the event is a START_DOCUMENT event, false otherwise
isEndDocument()
Section titled “isEndDocument()”isEndDocument(
event):event is EndDocumentEvent
Defined in: core/types.ts:200
Type guard function - Check if the event is an END_DOCUMENT event
Parameters
Section titled “Parameters”XML event to check
Returns
Section titled “Returns”event is EndDocumentEvent
true if the event is an END_DOCUMENT event, false otherwise