stax-xml
stax-xml
stax-xml
Section titled “stax-xml”Classes
Section titled “Classes”XmlParseError
Section titled “XmlParseError”Defined in: errors.ts:6
XML parse error with detailed issue information
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new XmlParseError(
issues):XmlParseError
Defined in: errors.ts:16
Parameters
Section titled “Parameters”issues
Section titled “issues”object[]
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”issues
Section titled “issues”issues:
object[]
Defined in: errors.ts:10
List of validation issues
path:
string[]
message
Section titled “message”message:
string
code:
string
Interfaces
Section titled “Interfaces”XmlArraySchema
Section titled “XmlArraySchema”Defined in: XmlArraySchema.ts:20
Schema for parsing XML array values
Extends
Section titled “Extends”XmlSchemaBase<T["_output"][],T["_input"][]>
Type Parameters
Section titled “Type Parameters”T extends XmlSchemaBase<unknown, unknown>
Properties
Section titled “Properties”element
Section titled “element”
readonlyelement:T
Defined in: XmlArraySchema.ts:26
xpath?
Section titled “xpath?”
readonlyoptionalxpath?:string
Defined in: XmlArraySchema.ts:27
_output
Section titled “_output”
readonly_output:T["_output"][]
Defined in: base.ts:32
Inherited from
Section titled “Inherited from”_input
Section titled “_input”
readonly_input:T["_input"][]
Defined in: base.ts:33
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”parse()
Section titled “parse()”parse(
input,options?):Promise<T["_output"][]>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<T["_output"][]>
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”parseSync()
Section titled “parseSync()”parseSync(
input,options?):T["_output"][]
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”T["_output"][]
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
Inherited from
Section titled “Inherited from”safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<T["_output"][]>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<T["_output"][]>>
Parse result with success flag
Inherited from
Section titled “Inherited from”safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<T["_output"][]>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<T["_output"][]>
Parse result with success flag
Inherited from
Section titled “Inherited from”transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,T["_input"][]>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, T["_input"][]>
New schema with transform applied
Inherited from
Section titled “Inherited from”optional()
Section titled “optional()”optional():
XmlSchemaBase<T["_output"][] |undefined,T["_input"][] |undefined>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<T["_output"][] | undefined, T["_input"][] | undefined>
New optional schema
Inherited from
Section titled “Inherited from”array()
Section titled “array()”array(
xpath?):XmlSchemaBase<T["_output"][][],T["_input"][][]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<T["_output"][][], T["_input"][][]>
New array schema
Inherited from
Section titled “Inherited from”write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”T["_output"][]
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
Inherited from
Section titled “Inherited from”writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”T["_output"][]
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”T["_output"][]
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
Inherited from
Section titled “Inherited from”writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
Inherited from
Section titled “Inherited from”XmlBuilder
Section titled “XmlBuilder”Defined in: XmlBuilder.ts:13
Builder API for creating XML schemas
Methods
Section titled “Methods”string()
Section titled “string()”string(
xpath?):XmlStringSchema
Defined in: XmlBuilder.ts:19
Create a string schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
Optional XPath expression
Returns
Section titled “Returns”String schema
number()
Section titled “number()”number(
xpath?):XmlNumberSchema
Defined in: XmlBuilder.ts:28
Create a number schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
Optional XPath expression
Returns
Section titled “Returns”Number schema
object()
Section titled “object()”object<
T>(shape,options?):XmlObjectSchema<T>
Defined in: XmlBuilder.ts:38
Create an object schema
Type Parameters
Section titled “Type Parameters”T extends XmlObjectShape
Parameters
Section titled “Parameters”T
Object shape definition
options?
Section titled “options?”Optional object options
Returns
Section titled “Returns”Object schema
array()
Section titled “array()”array<
T>(element,xpath?):XmlArraySchema<T>
Defined in: XmlBuilder.ts:48
Create an array schema
Type Parameters
Section titled “Type Parameters”T extends XmlSchema<unknown, unknown>
Parameters
Section titled “Parameters”element
Section titled “element”T
Element schema
xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”Array schema
XmlNumberSchema
Section titled “XmlNumberSchema”Defined in: XmlNumberSchema.ts:19
Schema for parsing XML number values
Extends
Section titled “Extends”XmlSchema<number,number>
Properties
Section titled “Properties”options
Section titled “options”options:
XmlNumberOptions={}
Defined in: XmlNumberSchema.ts:22
_output
Section titled “_output”
readonly_output:number
Defined in: base.ts:32
Inherited from
Section titled “Inherited from”_input
Section titled “_input”
readonly_input:number
Defined in: base.ts:33
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”xpath()
Section titled “xpath()”xpath(
path):XmlNumberSchema
Defined in: XmlNumberSchema.ts:90
Set XPath expression for locating the element
Parameters
Section titled “Parameters”string
XPath expression
Returns
Section titled “Returns”New schema with XPath
min(
value):XmlNumberSchema
Defined in: XmlNumberSchema.ts:99
Set minimum value
Parameters
Section titled “Parameters”number
Minimum value
Returns
Section titled “Returns”New schema with minimum
max(
value):XmlNumberSchema
Defined in: XmlNumberSchema.ts:108
Set maximum value
Parameters
Section titled “Parameters”number
Maximum value
Returns
Section titled “Returns”New schema with maximum
int():
XmlNumberSchema
Defined in: XmlNumberSchema.ts:116
Require integer value
Returns
Section titled “Returns”New schema that only accepts integers
parse()
Section titled “parse()”parse(
input,options?):Promise<number>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<number>
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”parseSync()
Section titled “parseSync()”parseSync(
input,options?):number
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”number
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
Inherited from
Section titled “Inherited from”safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<number>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<number>>
Parse result with success flag
Inherited from
Section titled “Inherited from”safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<number>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<number>
Parse result with success flag
Inherited from
Section titled “Inherited from”transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,number>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, number>
New schema with transform applied
Inherited from
Section titled “Inherited from”optional()
Section titled “optional()”optional():
XmlSchemaBase<number|undefined,number|undefined>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<number | undefined, number | undefined>
New optional schema
Inherited from
Section titled “Inherited from”array()
Section titled “array()”array(
xpath?):XmlSchemaBase<number[],number[]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<number[], number[]>
New array schema
Inherited from
Section titled “Inherited from”write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”number
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
Inherited from
Section titled “Inherited from”writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”number
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”number
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
Inherited from
Section titled “Inherited from”writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
Inherited from
Section titled “Inherited from”XmlObjectSchema
Section titled “XmlObjectSchema”Defined in: XmlObjectSchema.ts:37
Schema for parsing XML object values
Extends
Section titled “Extends”XmlSchema<InferObjectOutput<T>,unknown>
Type Parameters
Section titled “Type Parameters”T extends XmlObjectShape
Properties
Section titled “Properties”
readonlyshape:T
Defined in: XmlObjectSchema.ts:44
options
Section titled “options”options:
XmlObjectOptions={}
Defined in: XmlObjectSchema.ts:45
_output
Section titled “_output”
readonly_output:Output
Defined in: base.ts:32
Inherited from
Section titled “Inherited from”_input
Section titled “_input”
readonly_input:unknown
Defined in: base.ts:33
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”xpath()
Section titled “xpath()”xpath(
path):XmlObjectSchema<T>
Defined in: XmlObjectSchema.ts:56
Set XPath expression for locating the object
Parameters
Section titled “Parameters”string
XPath expression
Returns
Section titled “Returns”New schema with XPath
parse()
Section titled “parse()”parse(
input,options?):Promise<InferObjectOutput<T>>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<InferObjectOutput<T>>
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”parseSync()
Section titled “parseSync()”parseSync(
input,options?):Output
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Output
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
Inherited from
Section titled “Inherited from”safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<InferObjectOutput<T>>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<InferObjectOutput<T>>>
Parse result with success flag
Inherited from
Section titled “Inherited from”safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<InferObjectOutput<T>>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<InferObjectOutput<T>>
Parse result with success flag
Inherited from
Section titled “Inherited from”transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,unknown>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, unknown>
New schema with transform applied
Inherited from
Section titled “Inherited from”optional()
Section titled “optional()”optional():
XmlSchemaBase<InferObjectOutput<T> |undefined,unknown>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<InferObjectOutput<T> | undefined, unknown>
New optional schema
Inherited from
Section titled “Inherited from”array()
Section titled “array()”array(
xpath?):XmlSchemaBase<InferObjectOutput<T>[],unknown[]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<InferObjectOutput<T>[], unknown[]>
New array schema
Inherited from
Section titled “Inherited from”write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
Inherited from
Section titled “Inherited from”writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
Inherited from
Section titled “Inherited from”writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
Inherited from
Section titled “Inherited from”XmlOptionalSchema
Section titled “XmlOptionalSchema”Defined in: XmlOptionalSchema.ts:11
Schema for optional values
Extends
Section titled “Extends”XmlSchemaBase<T["_output"] |undefined,T["_input"] |undefined>
Type Parameters
Section titled “Type Parameters”T extends XmlSchemaBase<unknown, unknown>
Properties
Section titled “Properties”schema
Section titled “schema”
readonlyschema:T
Defined in: XmlOptionalSchema.ts:14
_output
Section titled “_output”
readonly_output:T["_output"] |undefined
Defined in: base.ts:32
Inherited from
Section titled “Inherited from”_input
Section titled “_input”
readonly_input:T["_input"] |undefined
Defined in: base.ts:33
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”parse()
Section titled “parse()”parse(
input,options?):Promise<T["_output"] |undefined>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<T["_output"] | undefined>
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”parseSync()
Section titled “parseSync()”parseSync(
input,options?):T["_output"] |undefined
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”T["_output"] | undefined
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
Inherited from
Section titled “Inherited from”safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<T["_output"] |undefined>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<T["_output"] | undefined>>
Parse result with success flag
Inherited from
Section titled “Inherited from”safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<T["_output"] |undefined>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<T["_output"] | undefined>
Parse result with success flag
Inherited from
Section titled “Inherited from”transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,T["_input"] |undefined>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, T["_input"] | undefined>
New schema with transform applied
Inherited from
Section titled “Inherited from”optional()
Section titled “optional()”optional():
XmlSchemaBase<T["_output"] |undefined,T["_input"] |undefined>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>
New optional schema
Inherited from
Section titled “Inherited from”array()
Section titled “array()”array(
xpath?):XmlSchemaBase<(T["_output"] |undefined)[], (T["_input"] |undefined)[]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<(T["_output"] | undefined)[], (T["_input"] | undefined)[]>
New array schema
Inherited from
Section titled “Inherited from”write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”T["_output"] | undefined
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
Inherited from
Section titled “Inherited from”writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”T["_output"] | undefined
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”T["_output"] | undefined
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
Inherited from
Section titled “Inherited from”writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
Inherited from
Section titled “Inherited from”XmlSchema
Section titled “XmlSchema”Defined in: XmlSchema.ts:10
Main XML schema class (extends XmlSchemaBase with all methods)
Extends
Section titled “Extends”XmlSchemaBase<Output,Input>
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”Output
Section titled “Output”Output
Input = Output
Properties
Section titled “Properties”_output
Section titled “_output”
readonly_output:Output
Defined in: base.ts:32
Inherited from
Section titled “Inherited from”_input
Section titled “_input”
readonly_input:Input
Defined in: base.ts:33
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”parse()
Section titled “parse()”parse(
input,options?):Promise<Output>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<Output>
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”parseSync()
Section titled “parseSync()”parseSync(
input,options?):Output
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Output
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
Inherited from
Section titled “Inherited from”safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<Output>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<Output>>
Parse result with success flag
Inherited from
Section titled “Inherited from”safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<Output>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<Output>
Parse result with success flag
Inherited from
Section titled “Inherited from”transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,Input>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, Input>
New schema with transform applied
Inherited from
Section titled “Inherited from”optional()
Section titled “optional()”optional():
XmlSchemaBase<Output|undefined,Input|undefined>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<Output | undefined, Input | undefined>
New optional schema
Inherited from
Section titled “Inherited from”array()
Section titled “array()”array(
xpath?):XmlSchemaBase<Output[],Input[]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<Output[], Input[]>
New array schema
Inherited from
Section titled “Inherited from”write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
Inherited from
Section titled “Inherited from”writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
Inherited from
Section titled “Inherited from”writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
Inherited from
Section titled “Inherited from”XmlStringSchema
Section titled “XmlStringSchema”Defined in: XmlStringSchema.ts:30
Schema for parsing XML string values
Extends
Section titled “Extends”XmlSchema<string,string>
Properties
Section titled “Properties”options
Section titled “options”options:
XmlStringOptions={}
Defined in: XmlStringSchema.ts:33
_output
Section titled “_output”
readonly_output:string
Defined in: base.ts:32
Inherited from
Section titled “Inherited from”_input
Section titled “_input”
readonly_input:string
Defined in: base.ts:33
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”xpath()
Section titled “xpath()”xpath(
path):XmlStringSchema
Defined in: XmlStringSchema.ts:47
Set XPath expression for locating the element
Parameters
Section titled “Parameters”string
XPath expression
Returns
Section titled “Returns”New schema with XPath
parse()
Section titled “parse()”parse(
input,options?):Promise<string>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<string>
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”parseSync()
Section titled “parseSync()”parseSync(
input,options?):string
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”string
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
Inherited from
Section titled “Inherited from”safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<string>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<string>>
Parse result with success flag
Inherited from
Section titled “Inherited from”safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<string>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<string>
Parse result with success flag
Inherited from
Section titled “Inherited from”transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,string>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, string>
New schema with transform applied
Inherited from
Section titled “Inherited from”optional()
Section titled “optional()”optional():
XmlSchemaBase<string|undefined,string|undefined>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<string | undefined, string | undefined>
New optional schema
Inherited from
Section titled “Inherited from”array()
Section titled “array()”array(
xpath?):XmlSchemaBase<string[],string[]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<string[], string[]>
New array schema
Inherited from
Section titled “Inherited from”write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”string
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
Inherited from
Section titled “Inherited from”writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”string
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”string
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
Inherited from
Section titled “Inherited from”writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
Inherited from
Section titled “Inherited from”XmlTransformSchema
Section titled “XmlTransformSchema”Defined in: XmlTransformSchema.ts:10
Schema for transforming parsed values
Extends
Section titled “Extends”XmlSchemaBase<Output,Input>
Type Parameters
Section titled “Type Parameters”Output
Section titled “Output”Output
Input
IntermediateOutput
Section titled “IntermediateOutput”IntermediateOutput = unknown
Properties
Section titled “Properties”_output
Section titled “_output”
readonly_output:Output
Defined in: base.ts:32
Inherited from
Section titled “Inherited from”_input
Section titled “_input”
readonly_input:Input
Defined in: base.ts:33
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”parse()
Section titled “parse()”parse(
input,options?):Promise<Output>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<Output>
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”parseSync()
Section titled “parseSync()”parseSync(
input,options?):Output
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Output
Parsed output
Throws
Section titled “Throws”If parsing fails
Inherited from
Section titled “Inherited from”precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
Inherited from
Section titled “Inherited from”safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<Output>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<Output>>
Parse result with success flag
Inherited from
Section titled “Inherited from”safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<Output>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<Output>
Parse result with success flag
Inherited from
Section titled “Inherited from”transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,Input>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, Input>
New schema with transform applied
Inherited from
Section titled “Inherited from”optional()
Section titled “optional()”optional():
XmlSchemaBase<Output|undefined,Input|undefined>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<Output | undefined, Input | undefined>
New optional schema
Inherited from
Section titled “Inherited from”array()
Section titled “array()”array(
xpath?):XmlSchemaBase<Output[],Input[]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<Output[], Input[]>
New array schema
Inherited from
Section titled “Inherited from”write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
Inherited from
Section titled “Inherited from”writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
Inherited from
Section titled “Inherited from”writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
Inherited from
Section titled “Inherited from”XmlSchemaBase
Section titled “XmlSchemaBase”Defined in: base.ts:31
Base abstract class for all XML schema types
Remarks
Section titled “Remarks”This class provides the foundation for zod-style declarative XML parsing. Each schema type extends this class and implements the parsing logic.
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”Output
Section titled “Output”Output
Input = Output
Properties
Section titled “Properties”_output
Section titled “_output”
readonly_output:Output
Defined in: base.ts:32
_input
Section titled “_input”
readonly_input:Input
Defined in: base.ts:33
Methods
Section titled “Methods”parse()
Section titled “parse()”parse(
input,options?):Promise<Output>
Defined in: base.ts:84
Parse XML asynchronously (public API)
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<Output>
Parsed output
Throws
Section titled “Throws”If parsing fails
parseSync()
Section titled “parseSync()”parseSync(
input,options?):Output
Defined in: base.ts:97
Parse XML synchronously (public API)
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Output
Parsed output
Throws
Section titled “Throws”If parsing fails
precompile()
Section titled “precompile()”precompile():
this
Defined in: base.ts:114
Build and cache the schema-specific IR program before parsing.
Normal parse() and parseSync() calls do this automatically. Call
precompile() during server or worker startup only when the one-time
lowering and executor creation cost should happen before the first request.
The returned schema is the same instance, so startup code can precompile a
shared schema and request handlers can use it normally.
Returns
Section titled “Returns”this
This schema instance
safeParse()
Section titled “safeParse()”safeParse(
input,options?):Promise<ParseResult<Output>>
Defined in: base.ts:127
Parse XML asynchronously with error handling
Parameters
Section titled “Parameters”XML string, stream, or async iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”Promise<ParseResult<Output>>
Parse result with success flag
safeParseSync()
Section titled “safeParseSync()”safeParseSync(
input,options?):ParseResult<Output>
Defined in: base.ts:148
Parse XML synchronously with error handling
Parameters
Section titled “Parameters”string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>
XML string, byte view, or sync iterator
options?
Section titled “options?”Parse options
Returns
Section titled “Returns”ParseResult<Output>
Parse result with success flag
transform()
Section titled “transform()”transform<
NewOutput>(fn):XmlSchemaBase<NewOutput,Input>
Defined in: base.ts:168
Transform the parsed output
Type Parameters
Section titled “Type Parameters”NewOutput
Section titled “NewOutput”NewOutput
Parameters
Section titled “Parameters”(value) => NewOutput
Transform function
Returns
Section titled “Returns”XmlSchemaBase<NewOutput, Input>
New schema with transform applied
optional()
Section titled “optional()”optional():
XmlSchemaBase<Output|undefined,Input|undefined>
Defined in: base.ts:176
Make this schema optional
Returns
Section titled “Returns”XmlSchemaBase<Output | undefined, Input | undefined>
New optional schema
array()
Section titled “array()”array(
xpath?):XmlSchemaBase<Output[],Input[]>
Defined in: base.ts:185
Convert this schema to an array schema
Parameters
Section titled “Parameters”xpath?
Section titled “xpath?”string
XPath expression for array elements
Returns
Section titled “Returns”XmlSchemaBase<Output[], Input[]>
New array schema
write()
Section titled “write()”write(
data,options?):Promise<string>
Defined in: base.ts:195
Write data to XML string asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<string>
XML string
writeToStream()
Section titled “writeToStream()”writeToStream(
data,stream,options?):Promise<void>
Defined in: base.ts:218
Write data to WritableStream asynchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
stream
Section titled “stream”WritableStream<Uint8Array<ArrayBufferLike>>
Writable stream to write to
options?
Section titled “options?”Write options
Returns
Section titled “Returns”Promise<void>
writeSync()
Section titled “writeSync()”writeSync(
data,options?):string
Defined in: base.ts:232
Write data to XML string synchronously (public API)
Parameters
Section titled “Parameters”Output
Data to write
options?
Section titled “options?”Write options
Returns
Section titled “Returns”string
XML string
writer()
Section titled “writer()”writer(
config):this
Defined in: base.ts:241
Configure writer settings for this schema
Parameters
Section titled “Parameters”config
Section titled “config”Writer configuration
Returns
Section titled “Returns”this
This schema with writer config
ParseOptions
Section titled “ParseOptions”Defined in: types.ts:10
Parse options for XML converter
Properties
Section titled “Properties”encoding?
Section titled “encoding?”
optionalencoding?:string
Defined in: types.ts:16
TextDecoder encoding label for byte input. String and materialized-event inputs are already decoded and ignore it.
Default Value
Section titled “Default Value”'utf-8'trimText?
Section titled “trimText?”
optionaltrimText?:boolean
Defined in: types.ts:22
Whether to trim whitespace from text content
Default Value
Section titled “Default Value”truedocumentMode?
Section titled “documentMode?”
optionaldocumentMode?:DocumentMode
Defined in: types.ts:29
XML document conformance mode.
Default Value
Section titled “Default Value”'fragment'maxDepth?
Section titled “maxDepth?”
optionalmaxDepth?:number
Defined in: types.ts:35
Maximum XML depth
Default Value
Section titled “Default Value”InfinitymaxEvents?
Section titled “maxEvents?”
optionalmaxEvents?:number
Defined in: types.ts:41
Maximum number of events to process
Default Value
Section titled “Default Value”InfinityXmlStringOptions
Section titled “XmlStringOptions”Defined in: types.ts:50
Options for string schema
Properties
Section titled “Properties”xpath?
Section titled “xpath?”
optionalxpath?:string
Defined in: types.ts:54
XPath expression to locate the element
XmlNumberOptions
Section titled “XmlNumberOptions”Defined in: types.ts:63
Options for number schema
Properties
Section titled “Properties”xpath?
Section titled “xpath?”
optionalxpath?:string
Defined in: types.ts:67
XPath expression to locate the element
optionalmin?:number
Defined in: types.ts:72
Minimum value
optionalmax?:number
Defined in: types.ts:77
Maximum value
optionalint?:boolean
Defined in: types.ts:83
Whether the number must be an integer
Default Value
Section titled “Default Value”falseXmlObjectOptions
Section titled “XmlObjectOptions”Defined in: types.ts:91
Options for object schema
Properties
Section titled “Properties”xpath?
Section titled “xpath?”
optionalxpath?:string
Defined in: types.ts:95
XPath expression to locate the element
XmlElementWriteConfig
Section titled “XmlElementWriteConfig”Defined in: types.ts:104
Writer configuration for XML element
Properties
Section titled “Properties”element?
Section titled “element?”
optionalelement?:string
Defined in: types.ts:108
Element name. Object fields may omit this to use the field key.
asAttribute?
Section titled “asAttribute?”
optionalasAttribute?:string
Defined in: types.ts:114
Write as attribute instead of element Value is the attribute name
namespace?
Section titled “namespace?”
optionalnamespace?:object
Defined in: types.ts:119
Namespace configuration
prefix?
Section titled “prefix?”
optionalprefix?:string
Namespace prefix (e.g., ‘dc’, ‘xsi’)
uri:
string
Namespace URI (e.g., ‘http://purl.org/dc/elements/1.1/’)
cdata?
Section titled “cdata?”
optionalcdata?:boolean
Defined in: types.ts:135
Wrap content in CDATA section
Default Value
Section titled “Default Value”falseselfClosing?
Section titled “selfClosing?”
optionalselfClosing?:boolean
Defined in: types.ts:141
Use self-closing tag for empty elements
Default Value
Section titled “Default Value”falsecomment?
Section titled “comment?”
optionalcomment?:string
Defined in: types.ts:146
Add XML comment before element
XmlWriteOptions
Section titled “XmlWriteOptions”Defined in: types.ts:154
Options for XML writer
Properties
Section titled “Properties”prettyPrint?
Section titled “prettyPrint?”
optionalprettyPrint?:boolean
Defined in: types.ts:159
Format output with indentation
Default Value
Section titled “Default Value”falseindentString?
Section titled “indentString?”
optionalindentString?:string
Defined in: types.ts:165
Indentation string
Default Value
Section titled “Default Value”' 'encoding?
Section titled “encoding?”
optionalencoding?:"utf-8"|"UTF-8"
Defined in: types.ts:171
Text encoding for output
Default Value
Section titled “Default Value”'utf-8'rootElement?
Section titled “rootElement?”
optionalrootElement?:string
Defined in: types.ts:177
Root element name If not provided, no root element wrapper is added
includeDeclaration?
Section titled “includeDeclaration?”
optionalincludeDeclaration?:boolean
Defined in: types.ts:183
Include XML declaration
Default Value
Section titled “Default Value”truexmlVersion?
Section titled “xmlVersion?”
optionalxmlVersion?:"1.0"
Defined in: types.ts:189
XML version for declaration
Default Value
Section titled “Default Value”'1.0'writer?
Section titled “writer?”
optionalwriter?:Writer|WriterSync|WriterSyncSink
Defined in: types.ts:197
Custom writer instance
- WriterSync: for writeSync() method
- WriterSyncSink: for writeSync() with custom sink
- Writer: for write() async method
Type Aliases
Section titled “Type Aliases”XmlObjectShape
Section titled “XmlObjectShape”XmlObjectShape =
Record<string,XmlSchema<unknown,unknown>>
Defined in: XmlObjectSchema.ts:21
Shape type for object schema
InferObjectOutput
Section titled “InferObjectOutput”InferObjectOutput<
T> ={ [K in keyof T]: T[K]["_output"] }
Defined in: XmlObjectSchema.ts:28
Infer output type from object shape
Type Parameters
Section titled “Type Parameters”T extends XmlObjectShape
ParseInput
Section titled “ParseInput”ParseInput =
string|Uint8Array|Iterable<Uint8Array> |Iterable<readonlyUint8Array[]> |Iterable<AnyXmlEvent> |AsyncIterable<Uint8Array> |AsyncIterable<readonlyUint8Array[]> |AsyncIterable<AnyXmlEvent> |ReadableStream<Uint8Array>
Defined in: base.ts:11
Parse input type for XML text, byte chunks, or materialized StAX events.
ParseResult
Section titled “ParseResult”ParseResult<
T> = {success:true;data:T; } | {success:false;error:XmlParseError; }
Defined in: errors.ts:28
Parse result type for safe parsing operations
Type Parameters
Section titled “Type Parameters”T
Infer<
T> =T["_output"]
Defined in: index.ts:72
Infer the parsed output type of a converter schema.
Type Parameters
Section titled “Type Parameters”T extends XmlSchema<unknown, unknown>
Variables
Section titled “Variables”
constx:XmlBuilder
Defined in: XmlBuilder.ts:58
Singleton builder instance