stax-xml
이 콘텐츠는 아직 번역되지 않았습니다.
stax-xml
stax-xml
Section titled “stax-xml”Classes
Section titled “Classes”EventReader
Section titled “EventReader”Defined in: packages/stax-xml/src/EventReader.ts:30
Event-object adapter over the batch-first async stream core.
Implements
Section titled “Implements”AsyncIterable<AnyXmlEvent>AsyncIterator<AnyXmlEvent>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventReader(
xmlStream,options?):EventReader
Defined in: packages/stax-xml/src/EventReader.ts:33
Parameters
Section titled “Parameters”xmlStream
Section titled “xmlStream”ReadableStream<Uint8Array<ArrayBufferLike>>
options?
Section titled “options?”EventReaderOptions = {}
Returns
Section titled “Returns”Accessors
Section titled “Accessors”XmlEventType
Section titled “XmlEventType”Get Signature
Section titled “Get Signature”get XmlEventType():
object
Defined in: packages/stax-xml/src/EventReader.ts:79
Returns
Section titled “Returns”object
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'
readonlyERROR:"ERROR"='ERROR'
Methods
Section titled “Methods”[asyncIterator]()
Section titled “[asyncIterator]()”[asyncIterator]():
AsyncIterator<AnyXmlEvent>
Defined in: packages/stax-xml/src/EventReader.ts:54
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: packages/stax-xml/src/EventReader.ts:63
Returns
Section titled “Returns”Promise<IteratorResult<AnyXmlEvent, any>>
Implementation of
Section titled “Implementation of”AsyncIterator.next
return()
Section titled “return()”return():
Promise<IteratorResult<AnyXmlEvent,any>>
Defined in: packages/stax-xml/src/EventReader.ts:67
Returns
Section titled “Returns”Promise<IteratorResult<AnyXmlEvent, any>>
Implementation of
Section titled “Implementation of”AsyncIterator.return
nextBatch()
Section titled “nextBatch()”nextBatch():
Promise<AnyXmlEvent[] |null>
Defined in: packages/stax-xml/src/EventReader.ts:71
Returns
Section titled “Returns”Promise<AnyXmlEvent[] | null>
batchedIterator()
Section titled “batchedIterator()”batchedIterator():
AsyncGenerator<AnyXmlEvent[]>
Defined in: packages/stax-xml/src/EventReader.ts:75
Returns
Section titled “Returns”AsyncGenerator<AnyXmlEvent[]>
EventReaderSync
Section titled “EventReaderSync”Defined in: packages/stax-xml/src/EventReaderSync.ts:30
Event-object adapter over the batch-first sync stream core.
Implements
Section titled “Implements”Iterable<AnyXmlEvent>Iterator<AnyXmlEvent>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventReaderSync(
xml,options?):EventReaderSync
Defined in: packages/stax-xml/src/EventReaderSync.ts:43
Parameters
Section titled “Parameters”string
options?
Section titled “options?”Returns
Section titled “Returns”Methods
Section titled “Methods”nextBatch()
Section titled “nextBatch()”nextBatch():
AnyXmlEvent[] |null
Defined in: packages/stax-xml/src/EventReaderSync.ts:75
Returns
Section titled “Returns”AnyXmlEvent[] | null
batchedIterator()
Section titled “batchedIterator()”batchedIterator():
IterableIterator<AnyXmlEvent[]>
Defined in: packages/stax-xml/src/EventReaderSync.ts:87
Returns
Section titled “Returns”IterableIterator<AnyXmlEvent[]>
[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<AnyXmlEvent>
Defined in: packages/stax-xml/src/EventReaderSync.ts:97
Returns
Section titled “Returns”Iterator<AnyXmlEvent>
Implementation of
Section titled “Implementation of”Iterable.[iterator]
next()
Section titled “next()”next():
IteratorResult<AnyXmlEvent>
Defined in: packages/stax-xml/src/EventReaderSync.ts:101
Returns
Section titled “Returns”IteratorResult<AnyXmlEvent>
Implementation of
Section titled “Implementation of”Iterator.next
return()
Section titled “return()”return():
IteratorResult<AnyXmlEvent>
Defined in: packages/stax-xml/src/EventReaderSync.ts:116
Returns
Section titled “Returns”IteratorResult<AnyXmlEvent>
Implementation of
Section titled “Implementation of”Iterator.return
StreamReader
Section titled “StreamReader”Defined in: packages/stax-xml/src/StreamReader.ts:36
Batch-first asynchronous StAX core over ReadableStream<Uint8Array>.
Implements
Section titled “Implements”AsyncIterable<StreamBatch>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StreamReader(
stream,options?):StreamReader
Defined in: packages/stax-xml/src/StreamReader.ts:45
Parameters
Section titled “Parameters”stream
Section titled “stream”ReadableStream<Uint8Array<ArrayBufferLike>>
options?
Section titled “options?”StreamReaderOptions = {}
Returns
Section titled “Returns”Methods
Section titled “Methods”nextBatch()
Section titled “nextBatch()”nextBatch():
Promise<StreamBatch|null>
Defined in: packages/stax-xml/src/StreamReader.ts:57
Returns
Section titled “Returns”Promise<StreamBatch | null>
return()
Section titled “return()”return():
Promise<void>
Defined in: packages/stax-xml/src/StreamReader.ts:76
Returns
Section titled “Returns”Promise<void>
batchedIterator()
Section titled “batchedIterator()”batchedIterator():
AsyncGenerator<StreamBatch>
Defined in: packages/stax-xml/src/StreamReader.ts:89
Returns
Section titled “Returns”AsyncGenerator<StreamBatch>
[asyncIterator]()
Section titled “[asyncIterator]()”[asyncIterator]():
AsyncGenerator<StreamBatch>
Defined in: packages/stax-xml/src/StreamReader.ts:105
Returns
Section titled “Returns”AsyncGenerator<StreamBatch>
Implementation of
Section titled “Implementation of”AsyncIterable.[asyncIterator]
currentGeneration()
Section titled “currentGeneration()”currentGeneration():
number
Defined in: packages/stax-xml/src/StreamReader.ts:109
Returns
Section titled “Returns”number
StreamReaderSync
Section titled “StreamReaderSync”Defined in: packages/stax-xml/src/StreamReaderSync.ts:41
Batch-first synchronous StAX core over bytes.
Implements
Section titled “Implements”Iterable<StreamBatch>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StreamReaderSync(
source,options?):StreamReaderSync
Defined in: packages/stax-xml/src/StreamReaderSync.ts:46
Parameters
Section titled “Parameters”source
Section titled “source”Iterable<StreamReaderSyncByteBatch>
options?
Section titled “options?”Returns
Section titled “Returns”Constructor
Section titled “Constructor”new StreamReaderSync(
source,options?):StreamReaderSync
Defined in: packages/stax-xml/src/StreamReaderSync.ts:47
Parameters
Section titled “Parameters”source
Section titled “source”Uint8Array
options?
Section titled “options?”Returns
Section titled “Returns”Methods
Section titled “Methods”nextBatch()
Section titled “nextBatch()”nextBatch():
StreamBatch|null
Defined in: packages/stax-xml/src/StreamReaderSync.ts:59
Returns
Section titled “Returns”StreamBatch | null
nextRawBatch()
Section titled “nextRawBatch()”nextRawBatch():
StreamReaderSyncRawBatch|null
Defined in: packages/stax-xml/src/StreamReaderSync.ts:81
Experimental
Return an experimental low-level batch view without creating per-event wrapper objects.
This API is intended for benchmark and scanner-style traversal paths. The existing nextBatch API remains the stable ergonomic surface.
Returns
Section titled “Returns”StreamReaderSyncRawBatch | null
batchedIterator()
Section titled “batchedIterator()”batchedIterator():
IterableIterator<StreamBatch>
Defined in: packages/stax-xml/src/StreamReaderSync.ts:113
Returns
Section titled “Returns”IterableIterator<StreamBatch>
[iterator]()
Section titled “[iterator]()”[iterator]():
IterableIterator<StreamBatch>
Defined in: packages/stax-xml/src/StreamReaderSync.ts:123
Returns
Section titled “Returns”IterableIterator<StreamBatch>
Implementation of
Section titled “Implementation of”Iterable.[iterator]
currentGeneration()
Section titled “currentGeneration()”currentGeneration():
number
Defined in: packages/stax-xml/src/StreamReaderSync.ts:127
Returns
Section titled “Returns”number
Writer
Section titled “Writer”Defined in: packages/stax-xml/src/Writer.ts:131
High-performance asynchronous XML writer implementing the StAX (Streaming API for XML) pattern.
This writer provides efficient streaming XML generation using WritableStream for handling large XML documents with automatic buffering, backpressure management, and namespace support.
This is an optimized implementation with:
- Optimization 1: Regex caching for entity escaping
- Optimization 2: Attribute string batching
- Optimization 3: Early entity check before regex execution
- Optimization 4: Qualified closing-tag stack (avoid rebuilding end tags)
- Optimization 5: Copy-on-write namespace frames
- Optimization 6: Indentation cache for pretty-print output
- Optimization 7:
TextEncoder.encodeInto()buffering to reduce intermediate byte arrays - Optimization 8: Flush by buffer view to avoid per-flush copy slices
Remarks
Section titled “Remarks”The writer supports streaming output with configurable buffering, automatic entity encoding, pretty printing with customizable indentation, and comprehensive namespace handling.
Examples
Section titled “Examples”Basic usage:
const writableStream = new WritableStream({ write(chunk) { console.log(new TextDecoder().decode(chunk)); }});
const writer = new Writer(writableStream);await writer.writeStartElement('root');await writer.writeElement('item', { id: '1' }, 'Hello World');await writer.writeEndElement();await writer.close();With pretty printing:
const options = { prettyPrint: true, indentString: ' ', autoEncodeEntities: true};const writer = new Writer(writableStream, options);Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Writer(
stream,options?):Writer
Defined in: packages/stax-xml/src/Writer.ts:170
Parameters
Section titled “Parameters”stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
options?
Section titled “options?”WriterOptions = {}
Returns
Section titled “Returns”Methods
Section titled “Methods”writeStartDocument()
Section titled “writeStartDocument()”writeStartDocument(
version?,encoding?):Promise<Writer>
Defined in: packages/stax-xml/src/Writer.ts:292
Write XML declaration
Parameters
Section titled “Parameters”version?
Section titled “version?”string = '1.0'
encoding?
Section titled “encoding?”string
Returns
Section titled “Returns”Promise<Writer>
writeEndDocument()
Section titled “writeEndDocument()”writeEndDocument():
Promise<void>
Defined in: packages/stax-xml/src/Writer.ts:317
End document (automatically close all elements)
Returns
Section titled “Returns”Promise<void>
writeStartElement()
Section titled “writeStartElement()”writeStartElement(
localName,options?):Promise<Writer>
Defined in: packages/stax-xml/src/Writer.ts:338
Write start 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: packages/stax-xml/src/Writer.ts:430
Write end element
Returns
Section titled “Returns”Promise<Writer>
writeCharacters()
Section titled “writeCharacters()”writeCharacters(
text):Promise<Writer>
Defined in: packages/stax-xml/src/Writer.ts:463
Write text
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Writer>
writeCData()
Section titled “writeCData()”writeCData(
cdata):Promise<Writer>
Defined in: packages/stax-xml/src/Writer.ts:485
Write CDATA section
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<Writer>
writeComment()
Section titled “writeComment()”writeComment(
comment):Promise<Writer>
Defined in: packages/stax-xml/src/Writer.ts:505
Write comment
Parameters
Section titled “Parameters”comment
Section titled “comment”string
Returns
Section titled “Returns”Promise<Writer>
writeRaw()
Section titled “writeRaw()”writeRaw(
xml):Promise<Writer>
Defined in: packages/stax-xml/src/Writer.ts:528
Write raw XML content without escaping
Parameters
Section titled “Parameters”string
Raw XML string to write
Returns
Section titled “Returns”Promise<Writer>
this (chainable)
flush()
Section titled “flush()”flush():
Promise<void>
Defined in: packages/stax-xml/src/Writer.ts:537
Manual flush
Returns
Section titled “Returns”Promise<void>
getMetrics()
Section titled “getMetrics()”getMetrics():
object
Defined in: packages/stax-xml/src/Writer.ts:544
Return metrics
Returns
Section titled “Returns”object
totalBytesWritten
Section titled “totalBytesWritten”totalBytesWritten:
number=0
flushCount
Section titled “flushCount”flushCount:
number=0
lastFlushTime
Section titled “lastFlushTime”lastFlushTime:
number=0
bufferUtilization
Section titled “bufferUtilization”bufferUtilization:
number
averageFlushSize
Section titled “averageFlushSize”averageFlushSize:
number
WriterSync
Section titled “WriterSync”Defined in: packages/stax-xml/src/WriterSync.ts:493
String-based sync writer.
Extends
Section titled “Extends”AbstractWriterSync
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WriterSync(
options?):WriterSync
Defined in: packages/stax-xml/src/WriterSync.ts:496
Parameters
Section titled “Parameters”options?
Section titled “options?”WriterSyncOptions = {}
Returns
Section titled “Returns”Overrides
Section titled “Overrides”AbstractWriterSync.constructor
Properties
Section titled “Properties”
protectedstate:number=WriterState.INITIAL
Defined in: packages/stax-xml/src/WriterSync.ts:78
Inherited from
Section titled “Inherited from”AbstractWriterSync.state
elementStack
Section titled “elementStack”
protectedelementStack:string[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:79
Inherited from
Section titled “Inherited from”AbstractWriterSync.elementStack
hasTextContentStack
Section titled “hasTextContentStack”
protectedhasTextContentStack:boolean[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:80
Inherited from
Section titled “Inherited from”AbstractWriterSync.hasTextContentStack
namespaceStack
Section titled “namespaceStack”
protectednamespaceStack:Map<string,string>[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:81
Inherited from
Section titled “Inherited from”AbstractWriterSync.namespaceStack
namespaceOwnedStack
Section titled “namespaceOwnedStack”
protectednamespaceOwnedStack:boolean[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:82
Inherited from
Section titled “Inherited from”AbstractWriterSync.namespaceOwnedStack
options
Section titled “options”
protectedreadonlyoptions:Required<WriterSyncOptions>
Defined in: packages/stax-xml/src/WriterSync.ts:83
Inherited from
Section titled “Inherited from”AbstractWriterSync.options
currentIndentLevel
Section titled “currentIndentLevel”
protectedcurrentIndentLevel:number=0
Defined in: packages/stax-xml/src/WriterSync.ts:84
Inherited from
Section titled “Inherited from”AbstractWriterSync.currentIndentLevel
needsIndent
Section titled “needsIndent”
protectedneedsIndent:boolean=false
Defined in: packages/stax-xml/src/WriterSync.ts:85
Inherited from
Section titled “Inherited from”AbstractWriterSync.needsIndent
indentCache
Section titled “indentCache”
protectedindentCache:string[]
Defined in: packages/stax-xml/src/WriterSync.ts:86
Inherited from
Section titled “Inherited from”AbstractWriterSync.indentCache
Methods
Section titled “Methods”writeStartDocument()
Section titled “writeStartDocument()”writeStartDocument(
version?,encoding?):this
Defined in: packages/stax-xml/src/WriterSync.ts:133
Writes the XML declaration (e.g., ).
Parameters
Section titled “Parameters”version?
Section titled “version?”string = '1.0'
encoding?
Section titled “encoding?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeStartDocument
writeEndDocument()
Section titled “writeEndDocument()”writeEndDocument():
void
Defined in: packages/stax-xml/src/WriterSync.ts:158
Indicates the end of the document and automatically closes all open elements.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeEndDocument
writeStartElement()
Section titled “writeStartElement()”writeStartElement(
localName,options?):this
Defined in: packages/stax-xml/src/WriterSync.ts:170
Parameters
Section titled “Parameters”localName
Section titled “localName”string
options?
Section titled “options?”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeStartElement
writeAttribute()
Section titled “writeAttribute()”writeAttribute(
localName,value,prefix?):this
Defined in: packages/stax-xml/src/WriterSync.ts:249
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”AbstractWriterSync.writeAttribute
writeNamespace()
Section titled “writeNamespace()”writeNamespace(
prefix,uri):this
Defined in: packages/stax-xml/src/WriterSync.ts:259
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeNamespace
writeCharacters()
Section titled “writeCharacters()”writeCharacters(
text):this
Defined in: packages/stax-xml/src/WriterSync.ts:276
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeCharacters
writeCData()
Section titled “writeCData()”writeCData(
cdata):this
Defined in: packages/stax-xml/src/WriterSync.ts:290
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeCData
writeComment()
Section titled “writeComment()”writeComment(
comment):this
Defined in: packages/stax-xml/src/WriterSync.ts:307
Parameters
Section titled “Parameters”comment
Section titled “comment”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeComment
writeProcessingInstruction()
Section titled “writeProcessingInstruction()”writeProcessingInstruction(
target,data?):this
Defined in: packages/stax-xml/src/WriterSync.ts:322
Parameters
Section titled “Parameters”target
Section titled “target”string
string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeProcessingInstruction
writeRaw()
Section titled “writeRaw()”writeRaw(
xml):this
Defined in: packages/stax-xml/src/WriterSync.ts:344
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeRaw
writeEndElement()
Section titled “writeEndElement()”writeEndElement():
this
Defined in: packages/stax-xml/src/WriterSync.ts:350
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeEndElement
setPrettyPrint()
Section titled “setPrettyPrint()”setPrettyPrint(
enabled):this
Defined in: packages/stax-xml/src/WriterSync.ts:382
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.setPrettyPrint
setIndentString()
Section titled “setIndentString()”setIndentString(
indentString):this
Defined in: packages/stax-xml/src/WriterSync.ts:387
Parameters
Section titled “Parameters”indentString
Section titled “indentString”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.setIndentString
isPrettyPrintEnabled()
Section titled “isPrettyPrintEnabled()”isPrettyPrintEnabled():
boolean
Defined in: packages/stax-xml/src/WriterSync.ts:393
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”AbstractWriterSync.isPrettyPrintEnabled
getIndentString()
Section titled “getIndentString()”getIndentString():
string
Defined in: packages/stax-xml/src/WriterSync.ts:397
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”AbstractWriterSync.getIndentString
_closeStartElementTag()
Section titled “_closeStartElementTag()”
protected_closeStartElementTag():void
Defined in: packages/stax-xml/src/WriterSync.ts:419
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AbstractWriterSync._closeStartElementTag
_writeNewline()
Section titled “_writeNewline()”
protected_writeNewline():void
Defined in: packages/stax-xml/src/WriterSync.ts:437
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AbstractWriterSync._writeNewline
getXmlString()
Section titled “getXmlString()”getXmlString():
string
Defined in: packages/stax-xml/src/WriterSync.ts:500
Returns
Section titled “Returns”string
_emit()
Section titled “_emit()”
protected_emit(chunk):void
Defined in: packages/stax-xml/src/WriterSync.ts:504
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”AbstractWriterSync._emit
WriterSyncSink
Section titled “WriterSyncSink”Defined in: packages/stax-xml/src/WriterSync.ts:512
Sink-based sync writer. Use this for file/buffer incremental writes.
Extends
Section titled “Extends”AbstractWriterSync
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WriterSyncSink(
sink,options?):WriterSyncSink
Defined in: packages/stax-xml/src/WriterSync.ts:520
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Overrides
Section titled “Overrides”AbstractWriterSync.constructor
Properties
Section titled “Properties”
protectedstate:number=WriterState.INITIAL
Defined in: packages/stax-xml/src/WriterSync.ts:78
Inherited from
Section titled “Inherited from”AbstractWriterSync.state
elementStack
Section titled “elementStack”
protectedelementStack:string[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:79
Inherited from
Section titled “Inherited from”AbstractWriterSync.elementStack
hasTextContentStack
Section titled “hasTextContentStack”
protectedhasTextContentStack:boolean[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:80
Inherited from
Section titled “Inherited from”AbstractWriterSync.hasTextContentStack
namespaceStack
Section titled “namespaceStack”
protectednamespaceStack:Map<string,string>[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:81
Inherited from
Section titled “Inherited from”AbstractWriterSync.namespaceStack
namespaceOwnedStack
Section titled “namespaceOwnedStack”
protectednamespaceOwnedStack:boolean[] =[]
Defined in: packages/stax-xml/src/WriterSync.ts:82
Inherited from
Section titled “Inherited from”AbstractWriterSync.namespaceOwnedStack
options
Section titled “options”
protectedreadonlyoptions:Required<WriterSyncOptions>
Defined in: packages/stax-xml/src/WriterSync.ts:83
Inherited from
Section titled “Inherited from”AbstractWriterSync.options
currentIndentLevel
Section titled “currentIndentLevel”
protectedcurrentIndentLevel:number=0
Defined in: packages/stax-xml/src/WriterSync.ts:84
Inherited from
Section titled “Inherited from”AbstractWriterSync.currentIndentLevel
needsIndent
Section titled “needsIndent”
protectedneedsIndent:boolean=false
Defined in: packages/stax-xml/src/WriterSync.ts:85
Inherited from
Section titled “Inherited from”AbstractWriterSync.needsIndent
indentCache
Section titled “indentCache”
protectedindentCache:string[]
Defined in: packages/stax-xml/src/WriterSync.ts:86
Inherited from
Section titled “Inherited from”AbstractWriterSync.indentCache
Methods
Section titled “Methods”writeStartDocument()
Section titled “writeStartDocument()”writeStartDocument(
version?,encoding?):this
Defined in: packages/stax-xml/src/WriterSync.ts:133
Writes the XML declaration (e.g., ).
Parameters
Section titled “Parameters”version?
Section titled “version?”string = '1.0'
encoding?
Section titled “encoding?”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeStartDocument
writeStartElement()
Section titled “writeStartElement()”writeStartElement(
localName,options?):this
Defined in: packages/stax-xml/src/WriterSync.ts:170
Parameters
Section titled “Parameters”localName
Section titled “localName”string
options?
Section titled “options?”Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeStartElement
writeAttribute()
Section titled “writeAttribute()”writeAttribute(
localName,value,prefix?):this
Defined in: packages/stax-xml/src/WriterSync.ts:249
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”AbstractWriterSync.writeAttribute
writeNamespace()
Section titled “writeNamespace()”writeNamespace(
prefix,uri):this
Defined in: packages/stax-xml/src/WriterSync.ts:259
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeNamespace
writeCharacters()
Section titled “writeCharacters()”writeCharacters(
text):this
Defined in: packages/stax-xml/src/WriterSync.ts:276
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeCharacters
writeCData()
Section titled “writeCData()”writeCData(
cdata):this
Defined in: packages/stax-xml/src/WriterSync.ts:290
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeCData
writeComment()
Section titled “writeComment()”writeComment(
comment):this
Defined in: packages/stax-xml/src/WriterSync.ts:307
Parameters
Section titled “Parameters”comment
Section titled “comment”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeComment
writeProcessingInstruction()
Section titled “writeProcessingInstruction()”writeProcessingInstruction(
target,data?):this
Defined in: packages/stax-xml/src/WriterSync.ts:322
Parameters
Section titled “Parameters”target
Section titled “target”string
string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeProcessingInstruction
writeRaw()
Section titled “writeRaw()”writeRaw(
xml):this
Defined in: packages/stax-xml/src/WriterSync.ts:344
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeRaw
writeEndElement()
Section titled “writeEndElement()”writeEndElement():
this
Defined in: packages/stax-xml/src/WriterSync.ts:350
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.writeEndElement
setPrettyPrint()
Section titled “setPrettyPrint()”setPrettyPrint(
enabled):this
Defined in: packages/stax-xml/src/WriterSync.ts:382
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.setPrettyPrint
setIndentString()
Section titled “setIndentString()”setIndentString(
indentString):this
Defined in: packages/stax-xml/src/WriterSync.ts:387
Parameters
Section titled “Parameters”indentString
Section titled “indentString”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”AbstractWriterSync.setIndentString
isPrettyPrintEnabled()
Section titled “isPrettyPrintEnabled()”isPrettyPrintEnabled():
boolean
Defined in: packages/stax-xml/src/WriterSync.ts:393
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”AbstractWriterSync.isPrettyPrintEnabled
getIndentString()
Section titled “getIndentString()”getIndentString():
string
Defined in: packages/stax-xml/src/WriterSync.ts:397
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”AbstractWriterSync.getIndentString
_closeStartElementTag()
Section titled “_closeStartElementTag()”
protected_closeStartElementTag():void
Defined in: packages/stax-xml/src/WriterSync.ts:419
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AbstractWriterSync._closeStartElementTag
_writeNewline()
Section titled “_writeNewline()”
protected_writeNewline():void
Defined in: packages/stax-xml/src/WriterSync.ts:437
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AbstractWriterSync._writeNewline
_emit()
Section titled “_emit()”
protected_emit(chunk):void
Defined in: packages/stax-xml/src/WriterSync.ts:536
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”AbstractWriterSync._emit
writeEndDocument()
Section titled “writeEndDocument()”writeEndDocument():
void
Defined in: packages/stax-xml/src/WriterSync.ts:577
Indicates the end of the document and automatically closes all open elements.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”AbstractWriterSync.writeEndDocument
flush()
Section titled “flush()”flush():
void
Defined in: packages/stax-xml/src/WriterSync.ts:585
Returns
Section titled “Returns”void
close()
Section titled “close()”close():
void
Defined in: packages/stax-xml/src/WriterSync.ts:592
Returns
Section titled “Returns”void
Interfaces
Section titled “Interfaces”EventReaderOptions
Section titled “EventReaderOptions”Defined in: packages/stax-xml/src/EventReader.ts:16
Asynchronous event reader options.
Properties
Section titled “Properties”autoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: packages/stax-xml/src/EventReader.ts:17
addEntities?
Section titled “addEntities?”
optionaladdEntities?:EntityDefinition[]
Defined in: packages/stax-xml/src/EventReader.ts:18
eventFilter?
Section titled “eventFilter?”
optionaleventFilter?:ParserEventFilter
Defined in: packages/stax-xml/src/EventReader.ts:19
documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: packages/stax-xml/src/EventReader.ts:20
namespaceAware?
Section titled “namespaceAware?”
optionalnamespaceAware?:boolean
Defined in: packages/stax-xml/src/EventReader.ts:21
maxChunkBytes?
Section titled “maxChunkBytes?”
optionalmaxChunkBytes?:number
Defined in: packages/stax-xml/src/EventReader.ts:22
EventReaderSyncOptions
Section titled “EventReaderSyncOptions”Defined in: packages/stax-xml/src/EventReaderSync.ts:17
Synchronous event reader options.
Properties
Section titled “Properties”autoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: packages/stax-xml/src/EventReaderSync.ts:18
addEntities?
Section titled “addEntities?”
optionaladdEntities?:EntityDefinition[]
Defined in: packages/stax-xml/src/EventReaderSync.ts:19
eventFilter?
Section titled “eventFilter?”
optionaleventFilter?:ParserEventFilter
Defined in: packages/stax-xml/src/EventReaderSync.ts:20
documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: packages/stax-xml/src/EventReaderSync.ts:21
namespaceAware?
Section titled “namespaceAware?”
optionalnamespaceAware?:boolean
Defined in: packages/stax-xml/src/EventReaderSync.ts:22
EntityDefinition
Section titled “EntityDefinition”Defined in: packages/stax-xml/src/IterableEventBackend.ts:17
Properties
Section titled “Properties”entity
Section titled “entity”entity:
string
Defined in: packages/stax-xml/src/IterableEventBackend.ts:18
value:
string
Defined in: packages/stax-xml/src/IterableEventBackend.ts:19
StreamReaderOptions
Section titled “StreamReaderOptions”Defined in: packages/stax-xml/src/StreamReader.ts:15
Asynchronous stream reader options.
Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: packages/stax-xml/src/StreamReader.ts:21
Text encoding passed to the active streaming backend.
Default Value
Section titled “Default Value”'utf-8'documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: packages/stax-xml/src/StreamReader.ts:28
XML document conformance mode.
Default Value
Section titled “Default Value”'fragment'StreamReaderSyncOptions
Section titled “StreamReaderSyncOptions”Defined in: packages/stax-xml/src/StreamReaderSync.ts:20
Synchronous stream reader options.
Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: packages/stax-xml/src/StreamReaderSync.ts:26
Text encoding passed to the active streaming backend.
Default Value
Section titled “Default Value”'utf-8'documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: packages/stax-xml/src/StreamReaderSync.ts:33
XML document conformance mode.
Default Value
Section titled “Default Value”'fragment'WriterOptions
Section titled “WriterOptions”Defined in: packages/stax-xml/src/Writer.ts:20
Configuration options for the Writer
Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: packages/stax-xml/src/Writer.ts:25
Text encoding for the output stream
Default Value
Section titled “Default Value”'utf-8'prettyPrint?
Section titled “prettyPrint?”
optionalprettyPrint?:boolean
Defined in: packages/stax-xml/src/Writer.ts:31
Whether to format output with indentation
Default Value
Section titled “Default Value”falseindentString?
Section titled “indentString?”
optionalindentString?:string
Defined in: packages/stax-xml/src/Writer.ts:37
String used for indentation when prettyPrint is true
Default Value
Section titled “Default Value”' 'addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: packages/stax-xml/src/Writer.ts:43
Additional custom entities to encode
entity
Section titled “entity”entity:
string
value:
string
Default Value
Section titled “Default Value”[]autoEncodeEntities?
Section titled “autoEncodeEntities?”
optionalautoEncodeEntities?:boolean
Defined in: packages/stax-xml/src/Writer.ts:49
Whether to automatically encode XML entities
Default Value
Section titled “Default Value”truenamespaces?
Section titled “namespaces?”
optionalnamespaces?:NamespaceDeclaration[]
Defined in: packages/stax-xml/src/Writer.ts:55
Namespace declarations to include
Default Value
Section titled “Default Value”[]bufferSize?
Section titled “bufferSize?”
optionalbufferSize?:number
Defined in: packages/stax-xml/src/Writer.ts:61
Internal buffer size in bytes
Default Value
Section titled “Default Value”16384highWaterMark?
Section titled “highWaterMark?”
optionalhighWaterMark?:number
Defined in: packages/stax-xml/src/Writer.ts:67
WritableStream backpressure threshold
Default Value
Section titled “Default Value”65536flushThreshold?
Section titled “flushThreshold?”
optionalflushThreshold?:number
Defined in: packages/stax-xml/src/Writer.ts:73
Automatic flush threshold (percentage of bufferSize)
Default Value
Section titled “Default Value”0.8enableAutoFlush?
Section titled “enableAutoFlush?”
optionalenableAutoFlush?:boolean
Defined in: packages/stax-xml/src/Writer.ts:79
Whether to enable automatic flushing
Default Value
Section titled “Default Value”trueSyncTextSink
Section titled “SyncTextSink”Defined in: packages/stax-xml/src/WriterSync.ts:7
Sink interface for custom sync targets.
Methods
Section titled “Methods”write()
Section titled “write()”write(
chunk):void
Defined in: packages/stax-xml/src/WriterSync.ts:8
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
flush()?
Section titled “flush()?”
optionalflush():void
Defined in: packages/stax-xml/src/WriterSync.ts:9
Returns
Section titled “Returns”void
close()?
Section titled “close()?”
optionalclose():void
Defined in: packages/stax-xml/src/WriterSync.ts:10
Returns
Section titled “Returns”void
WriterSyncOptions
Section titled “WriterSyncOptions”Defined in: packages/stax-xml/src/WriterSync.ts:16
Writer output options shared by string and sink variants.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: packages/stax-xml/src/WriterSync.ts:17
prettyPrint?
Section titled “prettyPrint?”
optionalprettyPrint?:boolean
Defined in: packages/stax-xml/src/WriterSync.ts:18
indentString?
Section titled “indentString?”
optionalindentString?:string
Defined in: packages/stax-xml/src/WriterSync.ts:19
addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: packages/stax-xml/src/WriterSync.ts:20
entity
Section titled “entity”entity:
string
value:
string
autoEncodeEntities?
Section titled “autoEncodeEntities?”
optionalautoEncodeEntities?:boolean
Defined in: packages/stax-xml/src/WriterSync.ts:21
namespaces?
Section titled “namespaces?”
optionalnamespaces?:NamespaceDeclaration[]
Defined in: packages/stax-xml/src/WriterSync.ts:22
WriterSyncSinkOptions
Section titled “WriterSyncSinkOptions”Defined in: packages/stax-xml/src/WriterSync.ts:28
Writer options for sink-based sync mode.
Extends
Section titled “Extends”Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: packages/stax-xml/src/WriterSync.ts:17
Inherited from
Section titled “Inherited from”prettyPrint?
Section titled “prettyPrint?”
optionalprettyPrint?:boolean
Defined in: packages/stax-xml/src/WriterSync.ts:18
Inherited from
Section titled “Inherited from”indentString?
Section titled “indentString?”
optionalindentString?:string
Defined in: packages/stax-xml/src/WriterSync.ts:19
Inherited from
Section titled “Inherited from”WriterSyncOptions.indentString
addEntities?
Section titled “addEntities?”
optionaladdEntities?:object[]
Defined in: packages/stax-xml/src/WriterSync.ts:20
entity
Section titled “entity”entity:
string
value:
string
Inherited from
Section titled “Inherited from”autoEncodeEntities?
Section titled “autoEncodeEntities?”
optionalautoEncodeEntities?:boolean
Defined in: packages/stax-xml/src/WriterSync.ts:21
Inherited from
Section titled “Inherited from”WriterSyncOptions.autoEncodeEntities
namespaces?
Section titled “namespaces?”
optionalnamespaces?:NamespaceDeclaration[]
Defined in: packages/stax-xml/src/WriterSync.ts:22
Inherited from
Section titled “Inherited from”bufferSize?
Section titled “bufferSize?”
optionalbufferSize?:number
Defined in: packages/stax-xml/src/WriterSync.ts:33
Internal character buffer size.
Default Value
Section titled “Default Value”16384enableAutoFlush?
Section titled “enableAutoFlush?”
optionalenableAutoFlush?:boolean
Defined in: packages/stax-xml/src/WriterSync.ts:39
Emit buffered chunks automatically when threshold is reached.
Default Value
Section titled “Default Value”trueflushOnClose?
Section titled “flushOnClose?”
optionalflushOnClose?:boolean
Defined in: packages/stax-xml/src/WriterSync.ts:45
Whether to call sink.flush() when the writer is finalized.
Default Value
Section titled “Default Value”falseflushThreshold?
Section titled “flushThreshold?”
optionalflushThreshold?:number
Defined in: packages/stax-xml/src/WriterSync.ts:52
Flush threshold (percentage or absolute char count). If <= 1, treated as percentage of bufferSize. Otherwise absolute char count.
Default Value
Section titled “Default Value”0.8ParseXmlTreeOptions
Section titled “ParseXmlTreeOptions”Defined in: packages/stax-xml/src/XmlObject.ts:25
Options shared by XML tree and compact object helper parsers.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: packages/stax-xml/src/XmlObject.ts:26
documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: packages/stax-xml/src/XmlObject.ts:27
autoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: packages/stax-xml/src/XmlObject.ts:28
addEntities?
Section titled “addEntities?”
optionaladdEntities?:EntityDefinition[]
Defined in: packages/stax-xml/src/XmlObject.ts:29
trimText?
Section titled “trimText?”
optionaltrimText?:boolean
Defined in: packages/stax-xml/src/XmlObject.ts:30
batchSize?
Section titled “batchSize?”
optionalbatchSize?:number
Defined in: packages/stax-xml/src/XmlObject.ts:31
ParseXmlObjectOptions
Section titled “ParseXmlObjectOptions”Defined in: packages/stax-xml/src/XmlObject.ts:35
Options for compact object projection.
Extends
Section titled “Extends”Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: packages/stax-xml/src/XmlObject.ts:26
Inherited from
Section titled “Inherited from”documentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: packages/stax-xml/src/XmlObject.ts:27
Inherited from
Section titled “Inherited from”ParseXmlTreeOptions.documentMode
autoDecodeEntities?
Section titled “autoDecodeEntities?”
optionalautoDecodeEntities?:boolean
Defined in: packages/stax-xml/src/XmlObject.ts:28
Inherited from
Section titled “Inherited from”ParseXmlTreeOptions.autoDecodeEntities
addEntities?
Section titled “addEntities?”
optionaladdEntities?:EntityDefinition[]
Defined in: packages/stax-xml/src/XmlObject.ts:29
Inherited from
Section titled “Inherited from”ParseXmlTreeOptions.addEntities
trimText?
Section titled “trimText?”
optionaltrimText?:boolean
Defined in: packages/stax-xml/src/XmlObject.ts:30
Inherited from
Section titled “Inherited from”batchSize?
Section titled “batchSize?”
optionalbatchSize?:number
Defined in: packages/stax-xml/src/XmlObject.ts:31
Inherited from
Section titled “Inherited from”attributePrefix?
Section titled “attributePrefix?”
optionalattributePrefix?:string
Defined in: packages/stax-xml/src/XmlObject.ts:37
Prefix applied to XML attributes. Defaults to @, so id becomes @id.
textKey?
Section titled “textKey?”
optionaltextKey?:string
Defined in: packages/stax-xml/src/XmlObject.ts:39
Key used for text in mixed-content objects. Defaults to #text.
cdataKey?
Section titled “cdataKey?”
optionalcdataKey?:string
Defined in: packages/stax-xml/src/XmlObject.ts:41
Key used for CDATA in compact objects. Defaults to #cdata.
alwaysArray?
Section titled “alwaysArray?”
optionalalwaysArray?:boolean
Defined in: packages/stax-xml/src/XmlObject.ts:43
When true, element children are always represented as arrays.
XmlTreeDocument
Section titled “XmlTreeDocument”Defined in: packages/stax-xml/src/XmlObject.ts:47
Document wrapper returned by parseXmlTree() and parseXmlTreeSync().
Properties
Section titled “Properties”type:
"document"
Defined in: packages/stax-xml/src/XmlObject.ts:48
children
Section titled “children”children:
XmlTreeNode[]
Defined in: packages/stax-xml/src/XmlObject.ts:49
XmlTreeElement
Section titled “XmlTreeElement”Defined in: packages/stax-xml/src/XmlObject.ts:55
Order-preserving XML element node.
Properties
Section titled “Properties”type:
"element"
Defined in: packages/stax-xml/src/XmlObject.ts:56
name:
string
Defined in: packages/stax-xml/src/XmlObject.ts:57
attributes
Section titled “attributes”attributes:
XmlObjectRecord<string>
Defined in: packages/stax-xml/src/XmlObject.ts:58
children
Section titled “children”children:
XmlTreeNode[]
Defined in: packages/stax-xml/src/XmlObject.ts:59
XmlTreeText
Section titled “XmlTreeText”Defined in: packages/stax-xml/src/XmlObject.ts:63
Text node in an order-preserving XML tree.
Properties
Section titled “Properties”type:
"text"
Defined in: packages/stax-xml/src/XmlObject.ts:64
value:
string
Defined in: packages/stax-xml/src/XmlObject.ts:65
XmlTreeCdata
Section titled “XmlTreeCdata”Defined in: packages/stax-xml/src/XmlObject.ts:69
CDATA node in an order-preserving XML tree.
Properties
Section titled “Properties”type:
"cdata"
Defined in: packages/stax-xml/src/XmlObject.ts:70
value:
string
Defined in: packages/stax-xml/src/XmlObject.ts:71
XmlObjectArray
Section titled “XmlObjectArray”Defined in: packages/stax-xml/src/XmlObject.ts:78
Array of compact object values used for repeated elements.
Extends
Section titled “Extends”Array<XmlObjectValue>
Indexable
Section titled “Indexable”[
n:number]:XmlObjectValue
XmlObjectRecord
Section titled “XmlObjectRecord”Defined in: packages/stax-xml/src/XmlObject.ts:81
Null-prototype record used by tree attributes and compact object nodes.
Type Parameters
Section titled “Type Parameters”T = XmlObjectValue
Indexable
Section titled “Indexable”[
key:string]:T
StreamEventView
Section titled “StreamEventView”Defined in: packages/stax-xml/src/stream-reader-core.ts:34
Batch-local event view.
Properties
Section titled “Properties”
readonlytype:StreamEventType
Defined in: packages/stax-xml/src/stream-reader-core.ts:35
Methods
Section titled “Methods”name()
Section titled “name()”name():
string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:36
Returns
Section titled “Returns”string | undefined
text()
Section titled “text()”text():
string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:37
Returns
Section titled “Returns”string | undefined
getAttributeCount()
Section titled “getAttributeCount()”getAttributeCount():
number
Defined in: packages/stax-xml/src/stream-reader-core.ts:38
Returns
Section titled “Returns”number
getAttributeName()
Section titled “getAttributeName()”getAttributeName(
index):string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:39
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
getAttributeValue()
Section titled “getAttributeValue()”getAttributeValue(
indexOrName):string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:40
Parameters
Section titled “Parameters”indexOrName
Section titled “indexOrName”string | number
Returns
Section titled “Returns”string | undefined
StreamBatch
Section titled “StreamBatch”Defined in: packages/stax-xml/src/stream-reader-core.ts:48
Batch view exposed by stream readers.
Extends
Section titled “Extends”Iterable<StreamEventView>
Properties
Section titled “Properties”eventCount
Section titled “eventCount”
readonlyeventCount:number
Defined in: packages/stax-xml/src/stream-reader-core.ts:49
Methods
Section titled “Methods”event()
Section titled “event()”event(
index):StreamEventView
Defined in: packages/stax-xml/src/stream-reader-core.ts:50
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”typeAt()
Section titled “typeAt()”typeAt(
index):StreamEventType
Defined in: packages/stax-xml/src/stream-reader-core.ts:51
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”nameAt()
Section titled “nameAt()”nameAt(
index):string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:52
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
textAt()
Section titled “textAt()”textAt(
index):string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:53
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string | undefined
attributeCountAt()
Section titled “attributeCountAt()”attributeCountAt(
index):number
Defined in: packages/stax-xml/src/stream-reader-core.ts:54
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”number
attributeNameAt()
Section titled “attributeNameAt()”attributeNameAt(
eventIndex,attrIndex):string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:55
Parameters
Section titled “Parameters”eventIndex
Section titled “eventIndex”number
attrIndex
Section titled “attrIndex”number
Returns
Section titled “Returns”string | undefined
attributeValueAt()
Section titled “attributeValueAt()”attributeValueAt(
eventIndex,attrIndexOrName):string|undefined
Defined in: packages/stax-xml/src/stream-reader-core.ts:56
Parameters
Section titled “Parameters”eventIndex
Section titled “eventIndex”number
attrIndexOrName
Section titled “attrIndexOrName”string | number
Returns
Section titled “Returns”string | undefined
StartDocumentEvent
Section titled “StartDocumentEvent”Defined in: packages/stax-xml/src/types.ts:48
Event fired when the document starts parsing
Properties
Section titled “Properties”type:
"START_DOCUMENT"
Defined in: packages/stax-xml/src/types.ts:49
EndDocumentEvent
Section titled “EndDocumentEvent”Defined in: packages/stax-xml/src/types.ts:57
Event fired when the document ends parsing
Properties
Section titled “Properties”type:
"END_DOCUMENT"
Defined in: packages/stax-xml/src/types.ts:58
StartElementEvent
Section titled “StartElementEvent”Defined in: packages/stax-xml/src/types.ts:66
Event fired when an XML element starts
Properties
Section titled “Properties”type:
"START_ELEMENT"
Defined in: packages/stax-xml/src/types.ts:67
name:
string
Defined in: packages/stax-xml/src/types.ts:68
localName?
Section titled “localName?”
optionallocalName?:string
Defined in: packages/stax-xml/src/types.ts:69
prefix?
Section titled “prefix?”
optionalprefix?:string
Defined in: packages/stax-xml/src/types.ts:70
optionaluri?:string
Defined in: packages/stax-xml/src/types.ts:71
attributes
Section titled “attributes”attributes:
Record<string,string>
Defined in: packages/stax-xml/src/types.ts:72
attributesWithPrefix?
Section titled “attributesWithPrefix?”
optionalattributesWithPrefix?:Record<string,AttributeInfo>
Defined in: packages/stax-xml/src/types.ts:73
EndElementEvent
Section titled “EndElementEvent”Defined in: packages/stax-xml/src/types.ts:76
Properties
Section titled “Properties”type:
"END_ELEMENT"
Defined in: packages/stax-xml/src/types.ts:77
name:
string
Defined in: packages/stax-xml/src/types.ts:78
localName?
Section titled “localName?”
optionallocalName?:string
Defined in: packages/stax-xml/src/types.ts:79
prefix?
Section titled “prefix?”
optionalprefix?:string
Defined in: packages/stax-xml/src/types.ts:80
optionaluri?:string
Defined in: packages/stax-xml/src/types.ts:81
CharactersEvent
Section titled “CharactersEvent”Defined in: packages/stax-xml/src/types.ts:84
Properties
Section titled “Properties”type:
"CHARACTERS"
Defined in: packages/stax-xml/src/types.ts:85
value:
string
Defined in: packages/stax-xml/src/types.ts:86
CdataEvent
Section titled “CdataEvent”Defined in: packages/stax-xml/src/types.ts:89
Properties
Section titled “Properties”type:
"CDATA"
Defined in: packages/stax-xml/src/types.ts:90
value:
string
Defined in: packages/stax-xml/src/types.ts:91
ErrorEvent
Section titled “ErrorEvent”Defined in: packages/stax-xml/src/types.ts:94
Properties
Section titled “Properties”type:
"ERROR"
Defined in: packages/stax-xml/src/types.ts:95
error:
Error
Defined in: packages/stax-xml/src/types.ts:96
XmlAttribute
Section titled “XmlAttribute”Defined in: packages/stax-xml/src/types.ts:114
Attribute interface (for Writer)
Properties
Section titled “Properties”prefix?
Section titled “prefix?”
optionalprefix?:string
Defined in: packages/stax-xml/src/types.ts:115
localName
Section titled “localName”localName:
string
Defined in: packages/stax-xml/src/types.ts:116
optionaluri?:string
Defined in: packages/stax-xml/src/types.ts:117
value:
string
Defined in: packages/stax-xml/src/types.ts:118
NamespaceDeclaration
Section titled “NamespaceDeclaration”Defined in: packages/stax-xml/src/types.ts:125
Namespace declaration interface (for Writer) Not used in this simple implementation.
Properties
Section titled “Properties”prefix
Section titled “prefix”prefix:
string
Defined in: packages/stax-xml/src/types.ts:126
uri:
string
Defined in: packages/stax-xml/src/types.ts:127
ProcessingInstruction
Section titled “ProcessingInstruction”Defined in: packages/stax-xml/src/types.ts:134
Processing instruction (PI) interface (for Writer) Not used in this simple implementation.
Properties
Section titled “Properties”target
Section titled “target”target:
string
Defined in: packages/stax-xml/src/types.ts:135
optionaldata?:string
Defined in: packages/stax-xml/src/types.ts:136
AttributeInfo
Section titled “AttributeInfo”Defined in: packages/stax-xml/src/types.ts:142
Attribute information interface
Properties
Section titled “Properties”value:
string
Defined in: packages/stax-xml/src/types.ts:143
localName
Section titled “localName”localName:
string
Defined in: packages/stax-xml/src/types.ts:144
prefix?
Section titled “prefix?”
optionalprefix?:string
Defined in: packages/stax-xml/src/types.ts:145
optionaluri?:string
Defined in: packages/stax-xml/src/types.ts:146
WriteElementOptions
Section titled “WriteElementOptions”Defined in: packages/stax-xml/src/types.ts:354
Element writing options interface (for Writer)
Properties
Section titled “Properties”prefix?
Section titled “prefix?”
optionalprefix?:string
Defined in: packages/stax-xml/src/types.ts:355
optionaluri?:string
Defined in: packages/stax-xml/src/types.ts:356
attributes?
Section titled “attributes?”
optionalattributes?:Record<string,string|AttributeInfo>
Defined in: packages/stax-xml/src/types.ts:357
selfClosing?
Section titled “selfClosing?”
optionalselfClosing?:boolean
Defined in: packages/stax-xml/src/types.ts:358
comment?
Section titled “comment?”
optionalcomment?:string
Defined in: packages/stax-xml/src/types.ts:359
ParserEventFilter
Section titled “ParserEventFilter”Defined in: packages/stax-xml/src/types.ts:362
Properties
Section titled “Properties”includeAttributes
Section titled “includeAttributes”includeAttributes:
boolean
Defined in: packages/stax-xml/src/types.ts:363
includeCharacters
Section titled “includeCharacters”includeCharacters:
boolean
Defined in: packages/stax-xml/src/types.ts:364
includeCdata
Section titled “includeCdata”includeCdata:
boolean
Defined in: packages/stax-xml/src/types.ts:365
Type Aliases
Section titled “Type Aliases”XmlSyncInput
Section titled “XmlSyncInput”XmlSyncInput =
string|Uint8Array|Iterable<Uint8Array>
Defined in: packages/stax-xml/src/XmlObject.ts:19
XML inputs that can be parsed without crossing an async boundary.
XmlAsyncInput
Section titled “XmlAsyncInput”XmlAsyncInput =
XmlSyncInput|AsyncIterable<Uint8Array> |ReadableStream<Uint8Array>
Defined in: packages/stax-xml/src/XmlObject.ts:22
XML inputs accepted by the convenience tree/object helpers.
XmlTreeNode
Section titled “XmlTreeNode”XmlTreeNode =
XmlTreeElement|XmlTreeText|XmlTreeCdata
Defined in: packages/stax-xml/src/XmlObject.ts:52
XmlObjectValue
Section titled “XmlObjectValue”XmlObjectValue =
string|XmlObjectRecord|XmlObjectArray
Defined in: packages/stax-xml/src/XmlObject.ts:75
Value stored in the compact object projection.
StreamEventType
Section titled “StreamEventType”StreamEventType = typeof
StreamEventType[keyof typeofStreamEventType]
Defined in: packages/stax-xml/src/stream-reader-core.ts:6
Numeric XML stream event type.
StreamReaderSyncByteBatch
Section titled “StreamReaderSyncByteBatch”StreamReaderSyncByteBatch = readonly
Uint8Array[]
Defined in: packages/stax-xml/src/stream-reader-core.ts:27
One synchronous byte batch consumed by StreamReaderSync.
StreamReaderSyncRawBatch
Section titled “StreamReaderSyncRawBatch”StreamReaderSyncRawBatch =
StreamReaderSyncWordTableBatch|StreamReaderSyncFrameBatch|StreamReaderSyncSoaStringArenaBatch
Defined in: packages/stax-xml/src/stream-reader-core.ts:152
Experimental
Experimental raw batch traversal view returned by StreamReaderSync.nextRawBatch.
XmlEventType
Section titled “XmlEventType”XmlEventType = typeof
XmlEventType[keyof typeofXmlEventType]
Defined in: packages/stax-xml/src/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|ErrorEvent
Defined in: packages/stax-xml/src/types.ts:102
Discriminated Union type for developer use
DocumentMode
Section titled “DocumentMode”DocumentMode =
"fragment"|"document"
Defined in: packages/stax-xml/src/types.ts:373
XML document conformance mode.
Variables
Section titled “Variables”StreamEventType
Section titled “StreamEventType”
constStreamEventType:object
Defined in: packages/stax-xml/src/stream-reader-core.ts:6
Event type constants exposed by stream readers.
Type Declaration
Section titled “Type Declaration”START_DOCUMENT
Section titled “START_DOCUMENT”
readonlySTART_DOCUMENT:0=0
END_DOCUMENT
Section titled “END_DOCUMENT”
readonlyEND_DOCUMENT:1=1
START_ELEMENT
Section titled “START_ELEMENT”
readonlySTART_ELEMENT:2=2
END_ELEMENT
Section titled “END_ELEMENT”
readonlyEND_ELEMENT:3=3
CHARACTERS
Section titled “CHARACTERS”
readonlyCHARACTERS:4=4
readonlyCDATA:5=5
XmlEventType
Section titled “XmlEventType”
constXmlEventType:object
Defined in: packages/stax-xml/src/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'
readonlyERROR:"ERROR"='ERROR'
Functions
Section titled “Functions”createEventReader()
Section titled “createEventReader()”createEventReader(
xmlStream,options?):EventReader
Defined in: packages/stax-xml/src/EventReader.ts:84
Parameters
Section titled “Parameters”xmlStream
Section titled “xmlStream”ReadableStream<Uint8Array<ArrayBufferLike>>
options?
Section titled “options?”EventReaderOptions = {}
Returns
Section titled “Returns”parseXmlTreeSync()
Section titled “parseXmlTreeSync()”parseXmlTreeSync(
input,options?):XmlTreeDocument
Defined in: packages/stax-xml/src/XmlObject.ts:91
Parse XML into an order-preserving tree using a synchronous input.
Parameters
Section titled “Parameters”options?
Section titled “options?”ParseXmlTreeOptions = {}
Returns
Section titled “Returns”parseXmlTree()
Section titled “parseXmlTree()”parseXmlTree(
input,options?):Promise<XmlTreeDocument>
Defined in: packages/stax-xml/src/XmlObject.ts:96
Parse XML into an order-preserving tree.
Parameters
Section titled “Parameters”options?
Section titled “options?”ParseXmlTreeOptions = {}
Returns
Section titled “Returns”Promise<XmlTreeDocument>
parseXmlObjectSync()
Section titled “parseXmlObjectSync()”parseXmlObjectSync(
input,options?):XmlObjectRecord
Defined in: packages/stax-xml/src/XmlObject.ts:104
Parse XML into a compact JavaScript object using a synchronous input.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”parseXmlObject()
Section titled “parseXmlObject()”parseXmlObject(
input,options?):Promise<XmlObjectRecord<XmlObjectValue>>
Defined in: packages/stax-xml/src/XmlObject.ts:112
Parse XML into a compact JavaScript object.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise<XmlObjectRecord<XmlObjectValue>>
isStartElement()
Section titled “isStartElement()”isStartElement(
event):event is StartElementEvent
Defined in: packages/stax-xml/src/types.ts:297
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: packages/stax-xml/src/types.ts:306
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: packages/stax-xml/src/types.ts:315
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: packages/stax-xml/src/types.ts:323
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
isError()
Section titled “isError()”isError(
event):event is ErrorEvent
Defined in: packages/stax-xml/src/types.ts:331
Type guard function - Check if the event is an ERROR event
Parameters
Section titled “Parameters”XML event to check
Returns
Section titled “Returns”event is ErrorEvent
true if the event is an ERROR event, false otherwise
isStartDocument()
Section titled “isStartDocument()”isStartDocument(
event):event is StartDocumentEvent
Defined in: packages/stax-xml/src/types.ts:339
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: packages/stax-xml/src/types.ts:347
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
References
Section titled “References”default
Section titled “default”Renames and re-exports WriterSync