콘텐츠로 이동
StAX-XML

stax-xml

이 콘텐츠는 아직 번역되지 않았습니다.

stax-xml


Defined in: errors.ts:6

XML parse error with detailed issue information

  • Error

new XmlParseError(issues): XmlParseError

Defined in: errors.ts:16

object[]

XmlParseError

Error.constructor

issues: object[]

Defined in: errors.ts:10

List of validation issues

path: string[]

message: string

code: string

Defined in: XmlArraySchema.ts:20

Schema for parsing XML array values

T extends XmlSchemaBase<unknown, unknown>

readonly element: T

Defined in: XmlArraySchema.ts:26

readonly optional xpath?: string

Defined in: XmlArraySchema.ts:27

readonly _output: T["_output"][]

Defined in: base.ts:32

XmlSchemaBase._output

readonly _input: T["_input"][]

Defined in: base.ts:33

XmlSchemaBase._input

parse(input, options?): Promise<T["_output"][]>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<T["_output"][]>

Parsed output

If parsing fails

XmlSchemaBase.parse

parseSync(input, options?): T["_output"][]

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

T["_output"][]

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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.

this

This schema instance

XmlSchemaBase.precompile

safeParse(input, options?): Promise<ParseResult<T["_output"][]>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<T["_output"][]>>

Parse result with success flag

XmlSchemaBase.safeParse

safeParseSync(input, options?): ParseResult<T["_output"][]>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<T["_output"][]>

Parse result with success flag

XmlSchemaBase.safeParseSync

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, T["_input"][]>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, T["_input"][]>

New schema with transform applied

XmlSchemaBase.transform

optional(): XmlSchemaBase<T["_output"][] | undefined, T["_input"][] | undefined>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<T["_output"][] | undefined, T["_input"][] | undefined>

New optional schema

XmlSchemaBase.optional

array(xpath?): XmlSchemaBase<T["_output"][][], T["_input"][][]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<T["_output"][][], T["_input"][][]>

New array schema

XmlSchemaBase.array

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

T["_output"][]

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchemaBase.write

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

T["_output"][]

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchemaBase.writeToStream

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

T["_output"][]

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchemaBase.writeSync

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchemaBase.writer


Defined in: XmlBuilder.ts:13

Builder API for creating XML schemas

string(xpath?): XmlStringSchema

Defined in: XmlBuilder.ts:19

Create a string schema

string

Optional XPath expression

XmlStringSchema

String schema

number(xpath?): XmlNumberSchema

Defined in: XmlBuilder.ts:28

Create a number schema

string

Optional XPath expression

XmlNumberSchema

Number schema

object<T>(shape, options?): XmlObjectSchema<T>

Defined in: XmlBuilder.ts:38

Create an object schema

T extends XmlObjectShape

T

Object shape definition

XmlObjectOptions

Optional object options

XmlObjectSchema<T>

Object schema

array<T>(element, xpath?): XmlArraySchema<T>

Defined in: XmlBuilder.ts:48

Create an array schema

T extends XmlSchema<unknown, unknown>

T

Element schema

string

XPath expression for array elements

XmlArraySchema<T>

Array schema


Defined in: XmlNumberSchema.ts:19

Schema for parsing XML number values

options: XmlNumberOptions = {}

Defined in: XmlNumberSchema.ts:22

readonly _output: number

Defined in: base.ts:32

XmlSchema._output

readonly _input: number

Defined in: base.ts:33

XmlSchema._input

xpath(path): XmlNumberSchema

Defined in: XmlNumberSchema.ts:90

Set XPath expression for locating the element

string

XPath expression

XmlNumberSchema

New schema with XPath

min(value): XmlNumberSchema

Defined in: XmlNumberSchema.ts:99

Set minimum value

number

Minimum value

XmlNumberSchema

New schema with minimum

max(value): XmlNumberSchema

Defined in: XmlNumberSchema.ts:108

Set maximum value

number

Maximum value

XmlNumberSchema

New schema with maximum

int(): XmlNumberSchema

Defined in: XmlNumberSchema.ts:116

Require integer value

XmlNumberSchema

New schema that only accepts integers

parse(input, options?): Promise<number>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<number>

Parsed output

If parsing fails

XmlSchema.parse

parseSync(input, options?): number

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

number

Parsed output

If parsing fails

XmlSchema.parseSync

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.

this

This schema instance

XmlSchema.precompile

safeParse(input, options?): Promise<ParseResult<number>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<number>>

Parse result with success flag

XmlSchema.safeParse

safeParseSync(input, options?): ParseResult<number>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<number>

Parse result with success flag

XmlSchema.safeParseSync

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, number>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, number>

New schema with transform applied

XmlSchema.transform

optional(): XmlSchemaBase<number | undefined, number | undefined>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<number | undefined, number | undefined>

New optional schema

XmlSchema.optional

array(xpath?): XmlSchemaBase<number[], number[]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<number[], number[]>

New array schema

XmlSchema.array

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

number

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchema.write

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

number

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchema.writeToStream

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

number

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchema.writeSync

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchema.writer


Defined in: XmlObjectSchema.ts:37

Schema for parsing XML object values

T extends XmlObjectShape

readonly shape: T

Defined in: XmlObjectSchema.ts:44

options: XmlObjectOptions = {}

Defined in: XmlObjectSchema.ts:45

readonly _output: Output

Defined in: base.ts:32

XmlSchema._output

readonly _input: unknown

Defined in: base.ts:33

XmlSchema._input

xpath(path): XmlObjectSchema<T>

Defined in: XmlObjectSchema.ts:56

Set XPath expression for locating the object

string

XPath expression

XmlObjectSchema<T>

New schema with XPath

parse(input, options?): Promise<InferObjectOutput<T>>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<InferObjectOutput<T>>

Parsed output

If parsing fails

XmlSchema.parse

parseSync(input, options?): Output

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchema.parseSync

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.

this

This schema instance

XmlSchema.precompile

safeParse(input, options?): Promise<ParseResult<InferObjectOutput<T>>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<InferObjectOutput<T>>>

Parse result with success flag

XmlSchema.safeParse

safeParseSync(input, options?): ParseResult<InferObjectOutput<T>>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<InferObjectOutput<T>>

Parse result with success flag

XmlSchema.safeParseSync

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, unknown>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, unknown>

New schema with transform applied

XmlSchema.transform

optional(): XmlSchemaBase<InferObjectOutput<T> | undefined, unknown>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<InferObjectOutput<T> | undefined, unknown>

New optional schema

XmlSchema.optional

array(xpath?): XmlSchemaBase<InferObjectOutput<T>[], unknown[]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<InferObjectOutput<T>[], unknown[]>

New array schema

XmlSchema.array

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchema.write

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

Output

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchema.writeToStream

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchema.writeSync

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchema.writer


Defined in: XmlOptionalSchema.ts:11

Schema for optional values

  • XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

T extends XmlSchemaBase<unknown, unknown>

readonly schema: T

Defined in: XmlOptionalSchema.ts:14

readonly _output: T["_output"] | undefined

Defined in: base.ts:32

XmlSchemaBase._output

readonly _input: T["_input"] | undefined

Defined in: base.ts:33

XmlSchemaBase._input

parse(input, options?): Promise<T["_output"] | undefined>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<T["_output"] | undefined>

Parsed output

If parsing fails

XmlSchemaBase.parse

parseSync(input, options?): T["_output"] | undefined

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

T["_output"] | undefined

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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.

this

This schema instance

XmlSchemaBase.precompile

safeParse(input, options?): Promise<ParseResult<T["_output"] | undefined>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<T["_output"] | undefined>>

Parse result with success flag

XmlSchemaBase.safeParse

safeParseSync(input, options?): ParseResult<T["_output"] | undefined>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<T["_output"] | undefined>

Parse result with success flag

XmlSchemaBase.safeParseSync

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, T["_input"] | undefined>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, T["_input"] | undefined>

New schema with transform applied

XmlSchemaBase.transform

optional(): XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

New optional schema

XmlSchemaBase.optional

array(xpath?): XmlSchemaBase<(T["_output"] | undefined)[], (T["_input"] | undefined)[]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<(T["_output"] | undefined)[], (T["_input"] | undefined)[]>

New array schema

XmlSchemaBase.array

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

T["_output"] | undefined

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchemaBase.write

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

T["_output"] | undefined

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchemaBase.writeToStream

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

T["_output"] | undefined

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchemaBase.writeSync

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchemaBase.writer


Defined in: XmlSchema.ts:10

Main XML schema class (extends XmlSchemaBase with all methods)

Output

Input = Output

readonly _output: Output

Defined in: base.ts:32

XmlSchemaBase._output

readonly _input: Input

Defined in: base.ts:33

XmlSchemaBase._input

parse(input, options?): Promise<Output>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<Output>

Parsed output

If parsing fails

XmlSchemaBase.parse

parseSync(input, options?): Output

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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.

this

This schema instance

XmlSchemaBase.precompile

safeParse(input, options?): Promise<ParseResult<Output>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<Output>>

Parse result with success flag

XmlSchemaBase.safeParse

safeParseSync(input, options?): ParseResult<Output>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<Output>

Parse result with success flag

XmlSchemaBase.safeParseSync

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, Input>

New schema with transform applied

XmlSchemaBase.transform

optional(): XmlSchemaBase<Output | undefined, Input | undefined>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<Output | undefined, Input | undefined>

New optional schema

XmlSchemaBase.optional

array(xpath?): XmlSchemaBase<Output[], Input[]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<Output[], Input[]>

New array schema

XmlSchemaBase.array

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchemaBase.write

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

Output

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchemaBase.writeToStream

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchemaBase.writeSync

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchemaBase.writer


Defined in: XmlStringSchema.ts:30

Schema for parsing XML string values

options: XmlStringOptions = {}

Defined in: XmlStringSchema.ts:33

readonly _output: string

Defined in: base.ts:32

XmlSchema._output

readonly _input: string

Defined in: base.ts:33

XmlSchema._input

xpath(path): XmlStringSchema

Defined in: XmlStringSchema.ts:47

Set XPath expression for locating the element

string

XPath expression

XmlStringSchema

New schema with XPath

parse(input, options?): Promise<string>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<string>

Parsed output

If parsing fails

XmlSchema.parse

parseSync(input, options?): string

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

string

Parsed output

If parsing fails

XmlSchema.parseSync

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.

this

This schema instance

XmlSchema.precompile

safeParse(input, options?): Promise<ParseResult<string>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<string>>

Parse result with success flag

XmlSchema.safeParse

safeParseSync(input, options?): ParseResult<string>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<string>

Parse result with success flag

XmlSchema.safeParseSync

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, string>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, string>

New schema with transform applied

XmlSchema.transform

optional(): XmlSchemaBase<string | undefined, string | undefined>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<string | undefined, string | undefined>

New optional schema

XmlSchema.optional

array(xpath?): XmlSchemaBase<string[], string[]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<string[], string[]>

New array schema

XmlSchema.array

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

string

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchema.write

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

string

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchema.writeToStream

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

string

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchema.writeSync

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchema.writer


Defined in: XmlTransformSchema.ts:10

Schema for transforming parsed values

Output

Input

IntermediateOutput = unknown

readonly _output: Output

Defined in: base.ts:32

XmlSchemaBase._output

readonly _input: Input

Defined in: base.ts:33

XmlSchemaBase._input

parse(input, options?): Promise<Output>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<Output>

Parsed output

If parsing fails

XmlSchemaBase.parse

parseSync(input, options?): Output

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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.

this

This schema instance

XmlSchemaBase.precompile

safeParse(input, options?): Promise<ParseResult<Output>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<Output>>

Parse result with success flag

XmlSchemaBase.safeParse

safeParseSync(input, options?): ParseResult<Output>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<Output>

Parse result with success flag

XmlSchemaBase.safeParseSync

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, Input>

New schema with transform applied

XmlSchemaBase.transform

optional(): XmlSchemaBase<Output | undefined, Input | undefined>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<Output | undefined, Input | undefined>

New optional schema

XmlSchemaBase.optional

array(xpath?): XmlSchemaBase<Output[], Input[]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<Output[], Input[]>

New array schema

XmlSchemaBase.array

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchemaBase.write

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

Output

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchemaBase.writeToStream

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchemaBase.writeSync

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchemaBase.writer


Defined in: base.ts:31

Base abstract class for all XML schema types

This class provides the foundation for zod-style declarative XML parsing. Each schema type extends this class and implements the parsing logic.

Output

Input = Output

readonly _output: Output

Defined in: base.ts:32

readonly _input: Input

Defined in: base.ts:33

parse(input, options?): Promise<Output>

Defined in: base.ts:84

Parse XML asynchronously (public API)

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<Output>

Parsed output

If parsing fails

parseSync(input, options?): Output

Defined in: base.ts:97

Parse XML synchronously (public API)

string | Uint8Array<ArrayBufferLike> | Iterable<AnyXmlEvent, any, any> | Iterable<Uint8Array<ArrayBufferLike>, any, any> | Iterable<readonly Uint8Array<ArrayBufferLike>[], any, any>

XML string or sync iterator

ParseOptions

Parse options

Output

Parsed output

If parsing fails

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.

this

This schema instance

safeParse(input, options?): Promise<ParseResult<Output>>

Defined in: base.ts:127

Parse XML asynchronously with error handling

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<ParseResult<Output>>

Parse result with success flag

safeParseSync(input, options?): ParseResult<Output>

Defined in: base.ts:148

Parse XML synchronously with error handling

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

ParseOptions

Parse options

ParseResult<Output>

Parse result with success flag

transform<NewOutput>(fn): XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:168

Transform the parsed output

NewOutput

(value) => NewOutput

Transform function

XmlSchemaBase<NewOutput, Input>

New schema with transform applied

optional(): XmlSchemaBase<Output | undefined, Input | undefined>

Defined in: base.ts:176

Make this schema optional

XmlSchemaBase<Output | undefined, Input | undefined>

New optional schema

array(xpath?): XmlSchemaBase<Output[], Input[]>

Defined in: base.ts:185

Convert this schema to an array schema

string

XPath expression for array elements

XmlSchemaBase<Output[], Input[]>

New array schema

write(data, options?): Promise<string>

Defined in: base.ts:195

Write data to XML string asynchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

Promise<string>

XML string

writeToStream(data, stream, options?): Promise<void>

Defined in: base.ts:218

Write data to WritableStream asynchronously (public API)

Output

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

writeSync(data, options?): string

Defined in: base.ts:232

Write data to XML string synchronously (public API)

Output

Data to write

XmlWriteOptions

Write options

string

XML string

writer(config): this

Defined in: base.ts:241

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config


Defined in: types.ts:10

Parse options for XML converter

optional encoding?: string

Defined in: types.ts:16

TextDecoder encoding label for byte input. String and materialized-event inputs are already decoded and ignore it.

'utf-8'

optional trimText?: boolean

Defined in: types.ts:22

Whether to trim whitespace from text content

true

optional documentMode?: DocumentMode

Defined in: types.ts:29

XML document conformance mode.

'fragment'

optional maxDepth?: number

Defined in: types.ts:35

Maximum XML depth

Infinity

optional maxEvents?: number

Defined in: types.ts:41

Maximum number of events to process

Infinity

Defined in: types.ts:50

Options for string schema

optional xpath?: string

Defined in: types.ts:54

XPath expression to locate the element


Defined in: types.ts:63

Options for number schema

optional xpath?: string

Defined in: types.ts:67

XPath expression to locate the element

optional min?: number

Defined in: types.ts:72

Minimum value

optional max?: number

Defined in: types.ts:77

Maximum value

optional int?: boolean

Defined in: types.ts:83

Whether the number must be an integer

false

Defined in: types.ts:91

Options for object schema

optional xpath?: string

Defined in: types.ts:95

XPath expression to locate the element


Defined in: types.ts:104

Writer configuration for XML element

optional element?: string

Defined in: types.ts:108

Element name. Object fields may omit this to use the field key.

optional asAttribute?: string

Defined in: types.ts:114

Write as attribute instead of element Value is the attribute name

optional namespace?: object

Defined in: types.ts:119

Namespace configuration

optional prefix?: string

Namespace prefix (e.g., ‘dc’, ‘xsi’)

uri: string

Namespace URI (e.g., ‘http://purl.org/dc/elements/1.1/’)

optional cdata?: boolean

Defined in: types.ts:135

Wrap content in CDATA section

false

optional selfClosing?: boolean

Defined in: types.ts:141

Use self-closing tag for empty elements

false

optional comment?: string

Defined in: types.ts:146

Add XML comment before element


Defined in: types.ts:154

Options for XML writer

optional prettyPrint?: boolean

Defined in: types.ts:159

Format output with indentation

false

optional indentString?: string

Defined in: types.ts:165

Indentation string

' '

optional encoding?: "utf-8" | "UTF-8"

Defined in: types.ts:171

Text encoding for output

'utf-8'

optional rootElement?: string

Defined in: types.ts:177

Root element name If not provided, no root element wrapper is added

optional includeDeclaration?: boolean

Defined in: types.ts:183

Include XML declaration

true

optional xmlVersion?: "1.0"

Defined in: types.ts:189

XML version for declaration

'1.0'

optional writer?: 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

XmlObjectShape = Record<string, XmlSchema<unknown, unknown>>

Defined in: XmlObjectSchema.ts:21

Shape type for object schema


InferObjectOutput<T> = { [K in keyof T]: T[K]["_output"] }

Defined in: XmlObjectSchema.ts:28

Infer output type from object shape

T extends XmlObjectShape


ParseInput = string | Uint8Array | Iterable<Uint8Array> | Iterable<readonly Uint8Array[]> | Iterable<AnyXmlEvent> | AsyncIterable<Uint8Array> | AsyncIterable<readonly Uint8Array[]> | AsyncIterable<AnyXmlEvent> | ReadableStream<Uint8Array>

Defined in: base.ts:11

Parse input type for XML text, byte chunks, or materialized StAX events.


ParseResult<T> = { success: true; data: T; } | { success: false; error: XmlParseError; }

Defined in: errors.ts:28

Parse result type for safe parsing operations

T


Infer<T> = T["_output"]

Defined in: index.ts:72

Infer the parsed output type of a converter schema.

T extends XmlSchema<unknown, unknown>

const x: XmlBuilder

Defined in: XmlBuilder.ts:58

Singleton builder instance