콘텐츠로 이동

stax-xml

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

stax-xml


Declarative XML Converter Module

This module provides a zod-style declarative API for parsing XML documents. It allows you to define XML schemas using a fluent API and parse XML with XPath support.

Basic usage:

import { x } from 'stax-xml/converter';
const schema = x.object({
title: x.string().xpath('/book/title'),
author: x.string().xpath('/book/author'),
price: x.number().xpath('/book/price')
});
const xml = '<book><title>TypeScript</title><author>John</author><price>29.99</price></book>';
const result = await schema.parse(xml);
// { title: 'TypeScript', author: 'John', price: 29.99 }

Defined in: XmlArraySchema.ts:15

Schema for parsing XML array values

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

T extends XmlSchemaBase<unknown, unknown>

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

Defined in: XmlArraySchema.ts:18

T

string

XmlArraySchema<T>

XmlSchemaBase<T['_output'][], T['_input'][]>.constructor

readonly schemaType: "ARRAY" = SchemaType.ARRAY

Defined in: XmlArraySchema.ts:16

Internal

Schema type identifier

XmlSchemaBase.schemaType

readonly element: T

Defined in: XmlArraySchema.ts:19

readonly optional xpath: string

Defined in: XmlArraySchema.ts:20

readonly _output: T["_output"][]

Defined in: base.ts:23

XmlSchemaBase._output

readonly _input: T["_input"][]

Defined in: base.ts:24

XmlSchemaBase._input

protected optional writeConfig: XmlElementWriteConfig

Defined in: base.ts:36

Internal

Writer configuration for this schema

XmlSchemaBase.writeConfig

static _createTransform: <Output, Input, NewOutput>(schema, fn) => XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:250

Output

Input

NewOutput

XmlSchemaBase<Output, Input>

(value) => NewOutput

XmlSchemaBase<NewOutput, Input>

XmlSchemaBase._createTransform

static _createOptional: <T>(schema) => XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:251

T extends XmlSchemaBase<unknown, unknown>

T

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

XmlSchemaBase._createOptional

static _createArray: <T>(schema, xpath?) => XmlSchemaBase<T["_output"][], T["_input"][]>

Defined in: base.ts:252

T extends XmlSchemaBase<unknown, unknown>

T

string

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

XmlSchemaBase._createArray

_parse(input, parseOptions?): T["_output"][]

Defined in: XmlArraySchema.ts:25

Parse XML input synchronously

ParseInput

XML string or sync iterator

ParseOptions

T["_output"][]

Parsed output

If parsing fails

XmlSchemaBase._parse

_parseAsync(input, parseOptions?): Promise<T["_output"][]>

Defined in: XmlArraySchema.ts:30

Parse XML input asynchronously

ParseInput

XML string, stream, or async iterator

ParseOptions

Promise<T["_output"][]>

Parsed output

If parsing fails

XmlSchemaBase._parseAsync

_parseFromPosition(iterator, startEvent, startDepth, options?, stateMachine?, parentContext?): T["_output"][] | Promise<T["_output"][]>

Defined in: XmlArraySchema.ts:39

Internal

Parse array from current iterator position (for nested array parsing)

AsyncIterator<AnyXmlEvent, any, any> | Iterator<AnyXmlEvent, any, any>

StartElementEvent

number

ParseOptions

XmlParsingStateMachine

unknown

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

XmlSchemaBase._parseFromPosition

_parseText(text): T["_output"][]

Defined in: XmlArraySchema.ts:74

Internal

Parse text content (used internally by parser)

string

Text content

T["_output"][]

Parsed output

XmlSchemaBase._parseText

_writeSync(data, options?): string

Defined in: XmlArraySchema.ts:84

Internal

Write array data to XML synchronously

T["_output"][]

XmlWriteOptions

string

XmlSchemaBase._writeSync

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

Defined in: XmlArraySchema.ts:147

Internal

Write array data to WritableStream asynchronously

T["_output"][]

WritableStream<Uint8Array<ArrayBufferLike>>

XmlWriteOptions

Promise<void>

XmlSchemaBase._write

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

Defined in: base.ts:109

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:120

Parse XML synchronously (public API)

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

T["_output"][]

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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

Defined in: base.ts:130

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:151

Parse XML synchronously with error handling

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

ParseResult<T["_output"][]>

Parse result with success flag

XmlSchemaBase.safeParseSync

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

Defined in: base.ts:171

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:179

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:188

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:198

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:221

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:235

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:244

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

new XmlBuilder(): XmlBuilder

XmlBuilder

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:15

Schema for parsing XML number values

new XmlNumberSchema(options): XmlNumberSchema

Defined in: XmlNumberSchema.ts:18

XmlNumberOptions = {}

XmlNumberSchema

XmlSchema.constructor

readonly schemaType: "NUMBER" = SchemaType.NUMBER

Defined in: XmlNumberSchema.ts:16

Internal

Schema type identifier

XmlSchema.schemaType

options: XmlNumberOptions = {}

Defined in: XmlNumberSchema.ts:18

readonly _output: number

Defined in: base.ts:23

XmlSchema._output

readonly _input: number

Defined in: base.ts:24

XmlSchema._input

protected optional writeConfig: XmlElementWriteConfig

Defined in: base.ts:36

Internal

Writer configuration for this schema

XmlSchema.writeConfig

static _createTransform: <Output, Input, NewOutput>(schema, fn) => XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:250

Output

Input

NewOutput

XmlSchemaBase<Output, Input>

(value) => NewOutput

XmlSchemaBase<NewOutput, Input>

XmlSchema._createTransform

static _createOptional: <T>(schema) => XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:251

T extends XmlSchemaBase<unknown, unknown>

T

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

XmlSchema._createOptional

static _createArray: <T>(schema, xpath?) => XmlSchemaBase<T["_output"][], T["_input"][]>

Defined in: base.ts:252

T extends XmlSchemaBase<unknown, unknown>

T

string

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

XmlSchema._createArray

_parse(input, parseOptions?): number

Defined in: XmlNumberSchema.ts:22

Parse XML input synchronously

ParseInput

XML string or sync iterator

ParseOptions

number

Parsed output

If parsing fails

XmlSchema._parse

_parseAsync(input, parseOptions?): Promise<number>

Defined in: XmlNumberSchema.ts:28

Parse XML input asynchronously

ParseInput

XML string, stream, or async iterator

ParseOptions

Promise<number>

Parsed output

If parsing fails

XmlSchema._parseAsync

_parseText(text): number

Defined in: XmlNumberSchema.ts:34

Internal

Parse text content (used internally by parser)

string

Text content

number

Parsed output

XmlSchema._parseText

_parseFromPosition(iterator, startEvent, startDepth, options?): number | Promise<number>

Defined in: XmlNumberSchema.ts:86

Internal

Parse from current iterator position

AsyncIterator<AnyXmlEvent, any, any> | Iterator<AnyXmlEvent, any, any>

StartElementEvent

number

ParseOptions

number | Promise<number>

XmlSchema._parseFromPosition

xpath(path): XmlNumberSchema

Defined in: XmlNumberSchema.ts:157

Set XPath expression for locating the element

string

XPath expression

XmlNumberSchema

New schema with XPath

min(value): XmlNumberSchema

Defined in: XmlNumberSchema.ts:170

Set minimum value

number

Minimum value

XmlNumberSchema

New schema with minimum

max(value): XmlNumberSchema

Defined in: XmlNumberSchema.ts:179

Set maximum value

number

Maximum value

XmlNumberSchema

New schema with maximum

int(): XmlNumberSchema

Defined in: XmlNumberSchema.ts:187

Require integer value

XmlNumberSchema

New schema that only accepts integers

_writeContent(data, options?): string

Defined in: XmlNumberSchema.ts:195

Internal

Write raw content only (used inside object schema)

number

XmlWriteOptions

string

_writeSync(data, options?): string

Defined in: XmlNumberSchema.ts:203

Internal

Write number data to XML synchronously

number

XmlWriteOptions

string

XmlSchema._writeSync

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

Defined in: XmlNumberSchema.ts:266

Internal

Write number data to WritableStream asynchronously

number

WritableStream<Uint8Array<ArrayBufferLike>>

XmlWriteOptions

Promise<void>

XmlSchema._write

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

Defined in: base.ts:109

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:120

Parse XML synchronously (public API)

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

number

Parsed output

If parsing fails

XmlSchema.parseSync

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

Defined in: base.ts:130

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:151

Parse XML synchronously with error handling

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

ParseResult<number>

Parse result with success flag

XmlSchema.safeParseSync

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

Defined in: base.ts:171

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:179

Make this schema optional

XmlSchemaBase<number | undefined, number | undefined>

New optional schema

XmlSchema.optional

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

Defined in: base.ts:188

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:198

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:221

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:235

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:244

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchema.writer


Defined in: XmlObjectSchema.ts:57

Schema for parsing XML object values

T extends XmlObjectShape

new XmlObjectSchema<T>(shape, options): XmlObjectSchema<T>

Defined in: XmlObjectSchema.ts:60

T

XmlObjectOptions = {}

XmlObjectSchema<T>

XmlSchema.constructor

readonly schemaType: "OBJECT" = SchemaType.OBJECT

Defined in: XmlObjectSchema.ts:58

Internal

Schema type identifier

XmlSchema.schemaType

readonly shape: T

Defined in: XmlObjectSchema.ts:61

options: XmlObjectOptions = {}

Defined in: XmlObjectSchema.ts:62

readonly _output: Output

Defined in: base.ts:23

XmlSchema._output

readonly _input: unknown

Defined in: base.ts:24

XmlSchema._input

protected optional writeConfig: XmlElementWriteConfig

Defined in: base.ts:36

Internal

Writer configuration for this schema

XmlSchema.writeConfig

static _createTransform: <Output, Input, NewOutput>(schema, fn) => XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:250

Output

Input

NewOutput

XmlSchemaBase<Output, Input>

(value) => NewOutput

XmlSchemaBase<NewOutput, Input>

XmlSchema._createTransform

static _createOptional: <T>(schema) => XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:251

T extends XmlSchemaBase<unknown, unknown>

T

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

XmlSchema._createOptional

static _createArray: <T>(schema, xpath?) => XmlSchemaBase<T["_output"][], T["_input"][]>

Defined in: base.ts:252

T extends XmlSchemaBase<unknown, unknown>

T

string

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

XmlSchema._createArray

_parse(input, parseOptions?): InferObjectOutput<T>

Defined in: XmlObjectSchema.ts:67

Parse XML input synchronously

ParseInput

XML string or sync iterator

ParseOptions

InferObjectOutput<T>

Parsed output

If parsing fails

XmlSchema._parse

_parseAsync(input, parseOptions?): Promise<InferObjectOutput<T>>

Defined in: XmlObjectSchema.ts:72

Parse XML input asynchronously

ParseInput

XML string, stream, or async iterator

ParseOptions

Promise<InferObjectOutput<T>>

Parsed output

If parsing fails

XmlSchema._parseAsync

_parseFromPosition(iterator, startEvent, startDepth, options?, stateMachine?, parentContext?): InferObjectOutput<T> | Promise<InferObjectOutput<T>>

Defined in: XmlObjectSchema.ts:81

Internal

Parse from current iterator position (for recursive/streaming parsing)

AsyncIterator<AnyXmlEvent, any, any> | Iterator<AnyXmlEvent, any, any>

StartElementEvent

number

ParseOptions

XmlParsingStateMachine

SchemaActivation

InferObjectOutput<T> | Promise<InferObjectOutput<T>>

XmlSchema._parseFromPosition

_parseText(text): InferObjectOutput<T>

Defined in: XmlObjectSchema.ts:141

Internal

Parse text content (used internally by parser)

string

Text content

InferObjectOutput<T>

Parsed output

XmlSchema._parseText

xpath(path): XmlObjectSchema<T>

Defined in: XmlObjectSchema.ts:152

Set XPath expression for locating the object

string

XPath expression

XmlObjectSchema<T>

New schema with XPath

_writeContent(data, options?): string

Defined in: XmlObjectSchema.ts:164

Internal

Write raw content only (used inside parent object/array schema)

InferObjectOutput<T>

XmlWriteOptions

string

_writeSync(data, options?): string

Defined in: XmlObjectSchema.ts:193

Internal

Write object data to XML synchronously

InferObjectOutput<T>

XmlWriteOptions

string

XmlSchema._writeSync

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

Defined in: XmlObjectSchema.ts:307

Internal

Write object data to WritableStream asynchronously

InferObjectOutput<T>

WritableStream<Uint8Array<ArrayBufferLike>>

XmlWriteOptions

Promise<void>

XmlSchema._write

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

Defined in: base.ts:109

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:120

Parse XML synchronously (public API)

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchema.parseSync

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

Defined in: base.ts:130

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:151

Parse XML synchronously with error handling

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

ParseResult<InferObjectOutput<T>>

Parse result with success flag

XmlSchema.safeParseSync

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

Defined in: base.ts:171

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:179

Make this schema optional

XmlSchemaBase<InferObjectOutput<T> | undefined, unknown>

New optional schema

XmlSchema.optional

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

Defined in: base.ts:188

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:198

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:221

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:235

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:244

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchema.writer


Defined in: XmlOptionalSchema.ts:10

Schema for optional values

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

T extends XmlSchemaBase<unknown, unknown>

new XmlOptionalSchema<T>(schema): XmlOptionalSchema<T>

Defined in: XmlOptionalSchema.ts:13

T

XmlOptionalSchema<T>

XmlSchemaBase<T[‘_output’] | undefined, T[‘_input’] | undefined>.constructor

readonly schemaType: "OPTIONAL" = SchemaType.OPTIONAL

Defined in: XmlOptionalSchema.ts:11

Internal

Schema type identifier

XmlSchemaBase.schemaType

readonly schema: T

Defined in: XmlOptionalSchema.ts:13

readonly _output: T["_output"] | undefined

Defined in: base.ts:23

XmlSchemaBase._output

readonly _input: T["_input"] | undefined

Defined in: base.ts:24

XmlSchemaBase._input

protected optional writeConfig: XmlElementWriteConfig

Defined in: base.ts:36

Internal

Writer configuration for this schema

XmlSchemaBase.writeConfig

static _createTransform: <Output, Input, NewOutput>(schema, fn) => XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:250

Output

Input

NewOutput

XmlSchemaBase<Output, Input>

(value) => NewOutput

XmlSchemaBase<NewOutput, Input>

XmlSchemaBase._createTransform

static _createOptional: <T>(schema) => XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:251

T extends XmlSchemaBase<unknown, unknown>

T

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

XmlSchemaBase._createOptional

static _createArray: <T>(schema, xpath?) => XmlSchemaBase<T["_output"][], T["_input"][]>

Defined in: base.ts:252

T extends XmlSchemaBase<unknown, unknown>

T

string

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

XmlSchemaBase._createArray

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

Defined in: XmlOptionalSchema.ts:17

Parse XML input synchronously

ParseInput

XML string or sync iterator

ParseOptions

Parse options

T["_output"] | undefined

Parsed output

If parsing fails

XmlSchemaBase._parse

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

Defined in: XmlOptionalSchema.ts:30

Parse XML input asynchronously

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<T["_output"] | undefined>

Parsed output

If parsing fails

XmlSchemaBase._parseAsync

_parseText(text): T["_output"] | undefined

Defined in: XmlOptionalSchema.ts:43

Internal

Parse text content (used internally by parser)

string

Text content

T["_output"] | undefined

Parsed output

XmlSchemaBase._parseText

_writeSync(data, options?): string

Defined in: XmlOptionalSchema.ts:63

Internal

Write optional data to XML synchronously

T["_output"] | undefined

XmlWriteOptions

string

XmlSchemaBase._writeSync

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

Defined in: XmlOptionalSchema.ts:74

Internal

Write optional data to WritableStream asynchronously

T["_output"] | undefined

WritableStream<Uint8Array<ArrayBufferLike>>

XmlWriteOptions

Promise<void>

XmlSchemaBase._write

optional _parseFromPosition(iterator, startEvent, startDepth, options?): T["_output"] | Promise<T["_output"] | undefined> | undefined

Defined in: base.ts:95

Internal

Parse from current iterator position (for streaming/recursive parsing)

Event iterator at current position

AsyncIterator<AnyXmlEvent, any, any> | Iterator<AnyXmlEvent, any, any>

StartElementEvent

The start element event

number

Depth of the start element

ParseOptions

Parse options

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

Parsed output

XmlSchemaBase._parseFromPosition

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

Defined in: base.ts:109

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:120

Parse XML synchronously (public API)

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

T["_output"] | undefined

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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

Defined in: base.ts:130

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:151

Parse XML synchronously with error handling

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

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:171

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:179

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:188

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:198

Write data to XML string asynchronously (public API)

Data to write

T["_output"] | undefined

XmlWriteOptions

Write options

Promise<string>

XML string

XmlSchemaBase.write

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

Defined in: base.ts:221

Write data to WritableStream asynchronously (public API)

Data to write

T["_output"] | undefined

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchemaBase.writeToStream

writeSync(data, options?): string

Defined in: base.ts:235

Write data to XML string synchronously (public API)

Data to write

T["_output"] | undefined

XmlWriteOptions

Write options

string

XML string

XmlSchemaBase.writeSync

writer(config): this

Defined in: base.ts:244

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)

  • XmlSchemaBase<Output, Input>

Output

Input = Output

new XmlSchema<Output, Input>(): XmlSchema<Output, Input>

XmlSchema<Output, Input>

XmlSchemaBase<Output, Input>.constructor

static _createTransform: <Output, Input, NewOutput>(schema, fn) => XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:250

Output

Input

NewOutput

XmlSchemaBase<Output, Input>

(value) => NewOutput

XmlSchemaBase<NewOutput, Input>

XmlSchemaBase._createTransform

static _createOptional: <T>(schema) => XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:251

T extends XmlSchemaBase<unknown, unknown>

T

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

XmlSchemaBase._createOptional

static _createArray: <T>(schema, xpath?) => XmlSchemaBase<T["_output"][], T["_input"][]>

Defined in: base.ts:252

T extends XmlSchemaBase<unknown, unknown>

T

string

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

XmlSchemaBase._createArray

readonly _output: Output

Defined in: base.ts:23

XmlSchemaBase._output

readonly _input: Input

Defined in: base.ts:24

XmlSchemaBase._input

abstract readonly schemaType: SchemaType

Defined in: base.ts:30

Internal

Schema type identifier

XmlSchemaBase.schemaType

protected optional writeConfig: XmlElementWriteConfig

Defined in: base.ts:36

Internal

Writer configuration for this schema

XmlStringSchema.writeConfig

abstract _parse(input, options?): Output

Defined in: base.ts:45

Parse XML input synchronously

ParseInput

XML string or sync iterator

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchemaBase._parse

abstract _parseAsync(input, options?): Promise<Output>

Defined in: base.ts:54

Parse XML input asynchronously

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<Output>

Parsed output

If parsing fails

XmlSchemaBase._parseAsync

abstract _writeSync(data, options?): string

Defined in: base.ts:63

Internal

Write data to XML string synchronously

Output

Data to write

XmlWriteOptions

Write options

string

XML string

XmlSchemaBase._writeSync

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

Defined in: base.ts:72

Internal

Write data to WritableStream asynchronously

Output

Data to write

WritableStream<Uint8Array<ArrayBufferLike>>

Writable stream to write to

XmlWriteOptions

Write options

Promise<void>

XmlSchemaBase._write

abstract optional _parseText(text): Output

Defined in: base.ts:84

Internal

Parse text content (used internally by parser)

string

Text content

Output

Parsed output

XmlSchemaBase._parseText

optional _parseFromPosition(iterator, startEvent, startDepth, options?): Output | Promise<Output>

Defined in: base.ts:95

Internal

Parse from current iterator position (for streaming/recursive parsing)

Event iterator at current position

AsyncIterator<AnyXmlEvent, any, any> | Iterator<AnyXmlEvent, any, any>

StartElementEvent

The start element event

number

Depth of the start element

ParseOptions

Parse options

Output | Promise<Output>

Parsed output

XmlSchemaBase._parseFromPosition

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

Defined in: base.ts:109

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:120

Parse XML synchronously (public API)

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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

Defined in: base.ts:130

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:151

Parse XML synchronously with error handling

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

ParseResult<Output>

Parse result with success flag

XmlSchemaBase.safeParseSync

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

Defined in: base.ts:171

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:179

Make this schema optional

XmlSchemaBase<Output | undefined, Input | undefined>

New optional schema

XmlSchemaBase.optional

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

Defined in: base.ts:188

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:198

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:221

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:235

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:244

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchemaBase.writer


Defined in: XmlStringSchema.ts:26

Schema for parsing XML string values

new XmlStringSchema(options): XmlStringSchema

Defined in: XmlStringSchema.ts:29

XmlStringOptions = {}

XmlStringSchema

XmlSchema.constructor

readonly schemaType: "STRING" = SchemaType.STRING

Defined in: XmlStringSchema.ts:27

Internal

Schema type identifier

XmlSchema.schemaType

options: XmlStringOptions = {}

Defined in: XmlStringSchema.ts:29

readonly _output: string

Defined in: base.ts:23

XmlSchema._output

readonly _input: string

Defined in: base.ts:24

XmlSchema._input

protected optional writeConfig: XmlElementWriteConfig

Defined in: base.ts:36

Internal

Writer configuration for this schema

XmlSchema.writeConfig

static _createTransform: <Output, Input, NewOutput>(schema, fn) => XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:250

Output

Input

NewOutput

XmlSchemaBase<Output, Input>

(value) => NewOutput

XmlSchemaBase<NewOutput, Input>

XmlSchema._createTransform

static _createOptional: <T>(schema) => XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:251

T extends XmlSchemaBase<unknown, unknown>

T

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

XmlSchema._createOptional

static _createArray: <T>(schema, xpath?) => XmlSchemaBase<T["_output"][], T["_input"][]>

Defined in: base.ts:252

T extends XmlSchemaBase<unknown, unknown>

T

string

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

XmlSchema._createArray

_parse(input, parseOptions?): string

Defined in: XmlStringSchema.ts:33

Parse XML input synchronously

ParseInput

XML string or sync iterator

ParseOptions

string

Parsed output

If parsing fails

XmlSchema._parse

_parseAsync(input, parseOptions?): Promise<string>

Defined in: XmlStringSchema.ts:38

Parse XML input asynchronously

ParseInput

XML string, stream, or async iterator

ParseOptions

Promise<string>

Parsed output

If parsing fails

XmlSchema._parseAsync

_parseText(text): string

Defined in: XmlStringSchema.ts:43

Internal

Parse text content (used internally by parser)

string

Text content

string

Parsed output

XmlSchema._parseText

_parseFromPosition(iterator, startEvent, startDepth, options?): string | Promise<string>

Defined in: XmlStringSchema.ts:51

Internal

Parse from current iterator position

AsyncIterator<AnyXmlEvent, any, any> | Iterator<AnyXmlEvent, any, any>

StartElementEvent

number

ParseOptions

string | Promise<string>

XmlSchema._parseFromPosition

xpath(path): XmlStringSchema

Defined in: XmlStringSchema.ts:122

Set XPath expression for locating the element

string

XPath expression

XmlStringSchema

New schema with XPath

_writeContent(data, options?): string

Defined in: XmlStringSchema.ts:134

Internal

Write raw content only (used inside object schema)

string

XmlWriteOptions

string

_writeSync(data, options?): string

Defined in: XmlStringSchema.ts:142

Internal

Write string data to XML synchronously

string

XmlWriteOptions

string

XmlSchema._writeSync

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

Defined in: XmlStringSchema.ts:210

Internal

Write string data to WritableStream asynchronously

string

WritableStream<Uint8Array<ArrayBufferLike>>

XmlWriteOptions

Promise<void>

XmlSchema._write

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

Defined in: base.ts:109

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:120

Parse XML synchronously (public API)

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

string

Parsed output

If parsing fails

XmlSchema.parseSync

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

Defined in: base.ts:130

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:151

Parse XML synchronously with error handling

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

ParseResult<string>

Parse result with success flag

XmlSchema.safeParseSync

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

Defined in: base.ts:171

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:179

Make this schema optional

XmlSchemaBase<string | undefined, string | undefined>

New optional schema

XmlSchema.optional

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

Defined in: base.ts:188

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:198

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:221

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:235

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:244

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchema.writer


Defined in: XmlTransformSchema.ts:11

Schema for transforming parsed values

  • XmlSchemaBase<Output, Input>

Output

Input

IntermediateOutput = unknown

new XmlTransformSchema<Output, Input, IntermediateOutput>(schema, transformFn): XmlTransformSchema<Output, Input, IntermediateOutput>

Defined in: XmlTransformSchema.ts:19

XmlSchemaBase<IntermediateOutput, Input>

(value) => Output

XmlTransformSchema<Output, Input, IntermediateOutput>

XmlSchemaBase<Output, Input>.constructor

readonly schemaType: "TRANSFORM" = SchemaType.TRANSFORM

Defined in: XmlTransformSchema.ts:12

Internal

Schema type identifier

XmlSchemaBase.schemaType

readonly schema: XmlSchemaBase<IntermediateOutput, Input>

Defined in: XmlTransformSchema.ts:15

Internal

readonly transformFn: (value) => Output

Defined in: XmlTransformSchema.ts:17

Internal

IntermediateOutput

Output

readonly _output: Output

Defined in: base.ts:23

XmlSchemaBase._output

readonly _input: Input

Defined in: base.ts:24

XmlSchemaBase._input

protected optional writeConfig: XmlElementWriteConfig

Defined in: base.ts:36

Internal

Writer configuration for this schema

XmlSchemaBase.writeConfig

static _createTransform: <Output, Input, NewOutput>(schema, fn) => XmlSchemaBase<NewOutput, Input>

Defined in: base.ts:250

Output

Input

NewOutput

XmlSchemaBase<Output, Input>

(value) => NewOutput

XmlSchemaBase<NewOutput, Input>

XmlSchemaBase._createTransform

static _createOptional: <T>(schema) => XmlSchemaBase<T["_output"] | undefined, T["_input"] | undefined>

Defined in: base.ts:251

T extends XmlSchemaBase<unknown, unknown>

T

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

XmlSchemaBase._createOptional

static _createArray: <T>(schema, xpath?) => XmlSchemaBase<T["_output"][], T["_input"][]>

Defined in: base.ts:252

T extends XmlSchemaBase<unknown, unknown>

T

string

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

XmlSchemaBase._createArray

_parse(input, options?): Output

Defined in: XmlTransformSchema.ts:28

Parse XML input synchronously

ParseInput

XML string or sync iterator

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchemaBase._parse

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

Defined in: XmlTransformSchema.ts:33

Parse XML input asynchronously

ParseInput

XML string, stream, or async iterator

ParseOptions

Parse options

Promise<Output>

Parsed output

If parsing fails

XmlSchemaBase._parseAsync

_parseFromPosition(iterator, startEvent, startDepth, options?): Output | Promise<Output>

Defined in: XmlTransformSchema.ts:42

Internal

Parse from current iterator position and apply transform

AsyncIterator<AnyXmlEvent, any, any> | Iterator<AnyXmlEvent, any, any>

StartElementEvent

number

ParseOptions

Output | Promise<Output>

XmlSchemaBase._parseFromPosition

_parseText(text): Output

Defined in: XmlTransformSchema.ts:63

Internal

Parse text content (used internally by parser)

string

Text content

Output

Parsed output

XmlSchemaBase._parseText

_writeSync(data, options?): string

Defined in: XmlTransformSchema.ts:76

Internal

Write transformed data to XML synchronously Note: Transform is not reversible, so writing is not supported

Output

XmlWriteOptions

string

XmlSchemaBase._writeSync

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

Defined in: XmlTransformSchema.ts:85

Internal

Write transformed data to WritableStream asynchronously Note: Transform is not reversible, so writing is not supported

Output

WritableStream<Uint8Array<ArrayBufferLike>>

XmlWriteOptions

Promise<void>

XmlSchemaBase._write

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

Defined in: base.ts:109

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:120

Parse XML synchronously (public API)

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

Output

Parsed output

If parsing fails

XmlSchemaBase.parseSync

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

Defined in: base.ts:130

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:151

Parse XML synchronously with error handling

XML string or sync iterator

string | Iterator<AnyXmlEvent, any, any>

ParseOptions

Parse options

ParseResult<Output>

Parse result with success flag

XmlSchemaBase.safeParseSync

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

Defined in: base.ts:171

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:179

Make this schema optional

XmlSchemaBase<Output | undefined, Input | undefined>

New optional schema

XmlSchemaBase.optional

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

Defined in: base.ts:188

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:198

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:221

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:235

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:244

Configure writer settings for this schema

XmlElementWriteConfig

Writer configuration

this

This schema with writer config

XmlSchemaBase.writer


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: types.ts:9

Parse options for XML converter

optional trimText: boolean

Defined in: types.ts:14

Whether to trim whitespace from text content

false

optional decodeEntities: boolean

Defined in: types.ts:20

Whether to decode XML entities

true

optional strict: boolean

Defined in: types.ts:26

Strict mode for parsing

false

optional maxDepth: number

Defined in: types.ts:32

Maximum XML depth

1000

optional maxEvents: number

Defined in: types.ts:38

Maximum number of events to process

1000000

Defined in: types.ts:46

Options for string schema

optional xpath: string

Defined in: types.ts:50

XPath expression to locate the element

optional min: number

Defined in: types.ts:55

Minimum string length

optional max: number

Defined in: types.ts:60

Maximum string length

optional pattern: RegExp

Defined in: types.ts:65

Regular expression pattern to validate against


Defined in: types.ts:73

Options for number schema

optional xpath: string

Defined in: types.ts:77

XPath expression to locate the element

optional min: number

Defined in: types.ts:82

Minimum value

optional max: number

Defined in: types.ts:87

Maximum value

optional int: boolean

Defined in: types.ts:93

Whether the number must be an integer

false

Defined in: types.ts:101

Options for object schema

optional xpath: string

Defined in: types.ts:105

XPath expression to locate the element

optional strict: boolean

Defined in: types.ts:111

Strict mode - reject unknown properties

false

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

Defined in: XmlObjectSchema.ts:41

Shape type for object schema


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

Defined in: XmlObjectSchema.ts:48

Infer output type from object shape

T extends XmlObjectShape


ParseInput = string | ReadableStream<Uint8Array> | AsyncIterator<AnyXmlEvent> | Iterator<AnyXmlEvent>

Defined in: base.ts:11

Parse input type - accepts string, sync iterator, async iterator, or ReadableStream


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:62

T extends XmlSchema<unknown, unknown>

const x: XmlBuilder

Defined in: XmlBuilder.ts:58

Singleton builder instance