@tinyactors/sxml 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,490 @@
1
+ import { type ChunkSource, type OutputSink } from './stream.ts';
2
+ export { type ChunkSource, type NodeWritable, nodeStreamSink, type OutputSink, type OutputSinkObject, outputReadableStream, textSink, writableStreamSink, } from './stream.ts';
3
+ /** Where load() finds sxml.wasm: a URL or path, the bytes, a compiled
4
+ * module, or a fetch Response. */
5
+ export type WasmSource = string | URL | BufferSource | WebAssembly.Module | Response | PromiseLike<Response>;
6
+ export interface LoadOptions {
7
+ /** Default: sxml.wasm next to this file, which has every language and
8
+ * every optional feature (Sxml.features). */
9
+ wasm?: WasmSource;
10
+ /** The DUCET for the uca-collation feature (D213), the
11
+ * text of allkeys.txt of the Unicode Collation Algorithm 16.0.0: a URL
12
+ * or path, or the bytes. Default: allkeys.txt next to this file, which
13
+ * the package ships; when that cannot be read, UCA collation URIs use
14
+ * sxml's fallback (and fallback=no is FOCH0002). false: none. A
15
+ * resolver's own answer for 'collation-data' comes first. */
16
+ collationData?: string | URL | BufferSource | false;
17
+ }
18
+ /** What a resolver is asked for (include/sxml/processor.h, "Resource
19
+ * resolver"). */
20
+ export type ResourceKind = 'xml-document' | 'text' | 'binary' | 'collection' | 'uri-collection' | 'xquery-module' | 'xslt-module' | 'xslt-package' | 'schema-document' | 'external-entity'
21
+ /** A file of the IANA Time Zone Database for the
22
+ * timezone-database feature: absoluteUri is 'urn:sxml:timezone-data:'
23
+ * and a zoneinfo path, a zone name ('Europe/Paris', a TZif file) or
24
+ * 'zone1970.tab'. Answer with the file's bytes. */
25
+ | 'timezone-data'
26
+ /** The DUCET for the uca-collation feature: absoluteUri
27
+ * is 'http://www.unicode.org/Public/UCA/16.0.0/allkeys.txt'. Answer
28
+ * with the file's text, or leave it to LoadOptions.collationData. */
29
+ | 'collation-data'
30
+ /** A CLDR file for the localization feature: absoluteUri
31
+ * is 'urn:sxml:locale-data:' and a path below CLDR's common/
32
+ * directory ('main/de.xml', 'rbnf/de.xml',
33
+ * 'supplemental/supplementalData.xml', 'supplemental/ordinals.xml').
34
+ * Answer with the file's bytes; without them dates are English with
35
+ * '[Language: en]'. */
36
+ | 'locale-data';
37
+ export interface ResourceRequest {
38
+ kind: ResourceKind;
39
+ /** The URI as the expression wrote it, such as fn:doc's argument. */
40
+ uriReference: string;
41
+ /** uriReference resolved against the static base URI; '' when that is
42
+ * absent and uriReference is relative. */
43
+ absoluteUri: string;
44
+ }
45
+ /** Answers fn:doc, fn:unparsed-text and the other resource functions: the
46
+ * resource's bytes or text, or null/undefined when it is not available
47
+ * (FODC0002 for fn:doc). Called synchronously, during an evaluation; it
48
+ * must not use the processor. An exception it throws stops the evaluation
49
+ * and is rethrown by the call that started it. An XML document may also
50
+ * be a ChunkSource, read a chunk at a time as it is parsed (D294). */
51
+ export type Resolver = (request: ResourceRequest) => string | Uint8Array | ChunkSource | null | undefined;
52
+ export interface ProcessorOptions {
53
+ /** Default: nothing is available. */
54
+ resolver?: Resolver;
55
+ /** The optional features the processor may use, by name, each one of
56
+ * Sxml.features. Default: every feature of the module. Without a
57
+ * feature, sxml behaves as the specifications say a processor without
58
+ * it does. */
59
+ features?: string[];
60
+ /** tree-sitter languages for sxml:parse-code beside the built-in ones,
61
+ * loaded with Sxml.loadCodeLanguage; one with a built-in language's
62
+ * name replaces it. Default: none. */
63
+ codeLanguages?: CodeLanguage[];
64
+ /** The size of the chunks an OutputSink receives, in bytes; default
65
+ * 65,536 (D294). */
66
+ outputChunkByteCount?: number;
67
+ /** The most evaluation steps one evaluation may take before it stops
68
+ * with an error (the C processor limit maximum_evaluation_step_count):
69
+ * a whole number up to 2^53; default, and 0, sxml's 100,000,000, a few
70
+ * seconds of work. A streamed document grants 500 steps more for each
71
+ * element it reads, so long streams run within it (D295). */
72
+ maximumEvaluationStepCount?: number;
73
+ /** For tests: fail this allocation (counted from 1) with out of memory. */
74
+ failingAllocationNumber?: number;
75
+ }
76
+ /** A tree-sitter language file to load (Sxml.loadCodeLanguage). */
77
+ export interface CodeLanguageOptions {
78
+ /** The language file, as `tree-sitter build --wasm` writes it
79
+ * (tree-sitter-NAME.wasm): a URL or path, the bytes, a compiled
80
+ * module, or a fetch Response. */
81
+ wasm: WasmSource;
82
+ /** The language's name in sxml:parse-code: ASCII letters, digits, '_',
83
+ * '-', '+' and '.'. Default: NAME of the file's tree_sitter_NAME
84
+ * function. */
85
+ name?: string;
86
+ /** The text of the grammar's queries/highlights.scm; default none, so
87
+ * no highlight attributes. */
88
+ highlights?: string;
89
+ /** The text of queries/locals.scm; default none. */
90
+ locals?: string;
91
+ /** The text of queries/injections.scm; default none. */
92
+ injections?: string;
93
+ /** tree-sitter.json's injection-regex, which other languages'
94
+ * injections match to mean this one; default: only its name. */
95
+ injectionRegex?: string;
96
+ }
97
+ /** JSON-like data, converted to XDM as fn:parse-json converts its JSON text
98
+ * (objects are maps, arrays are arrays, numbers xs:double, null the empty
99
+ * sequence); a string is an xs:string. */
100
+ export type JsonData = string | number | boolean | null | JsonData[] | {
101
+ [key: string]: JsonData;
102
+ };
103
+ /** A value to bind: one this processor made, or JSON-like data. */
104
+ export type Input = Value | JsonData;
105
+ export interface StaticOptions {
106
+ /** Namespace bindings, prefix to URI; the prefix '' sets the default
107
+ * element namespace. Added to the predeclared prefixes (xs, fn, map,
108
+ * array, math, err, ...) and to those of the processor's features (bin
109
+ * with expath-binary), which they may rebind. */
110
+ namespaces?: Record<string, string>;
111
+ /** The static base URI, against which fn:doc resolves relative URIs. */
112
+ baseUri?: string;
113
+ }
114
+ export interface CompileOptions extends StaticOptions {
115
+ /** The external variables, as NCNames or Q{uri}local, each item()*. */
116
+ variables?: string[];
117
+ }
118
+ export interface EvaluateOptions {
119
+ /** The context value; absent means no focus (XPDY0002 when used). */
120
+ context?: Input;
121
+ /** Values of the declared variables; a missing one raises XPDY0002. */
122
+ variables?: Record<string, Input>;
123
+ }
124
+ /** The serialization parameters of Serialization 4.0, as fn:serialize
125
+ * takes them: method ('xml', 'html', 'xhtml', 'text', 'json', 'adaptive',
126
+ * 'csv'), indent, omit-xml-declaration, item-separator, ... Keys may be
127
+ * written in camelCase (omitXmlDeclaration); yes/no parameters take
128
+ * booleans. Without options, a value is written by the adaptive method. */
129
+ export type SerializationOptions = Record<string, JsonData>;
130
+ /** Trace output (XSLT 4.0, 23.1 and 23.2; F&O 4.0, fn:trace and
131
+ * fn:message): an xsl:message or failed xsl:assert as the text method
132
+ * writes it, fn:trace and fn:message by the adaptive method. */
133
+ export interface Message {
134
+ text: string;
135
+ /** xsl:message: its error code's local name (XTMM9000 by default);
136
+ * fn:trace and fn:message: the label. */
137
+ code: string;
138
+ /** xsl:message terminate="yes" and xsl:assert: the call then throws. */
139
+ isTerminating: boolean;
140
+ sourceName: string;
141
+ lineNumber: number;
142
+ columnNumber: number;
143
+ }
144
+ export interface QueryCompileOptions extends StaticOptions {
145
+ }
146
+ /** A tree an updating query changed (XQuery Update Facility 3.0,
147
+ * upd:applyUpdates): trees never change in sxml, so the update makes a
148
+ * new tree; putting it where the original was is the host's. */
149
+ export interface UpdatedTree {
150
+ /** The root as the query read it: a document node you bound, or a
151
+ * parentless node. */
152
+ original: Value;
153
+ /** The root of the new tree with every change made. */
154
+ updated: Value;
155
+ }
156
+ /** A document fn:put stores (XQUF 3.0, 6.1): writing it at uri is the
157
+ * host's. */
158
+ export interface PutDocument {
159
+ /** fn:put's $uri resolved against the static base URI. */
160
+ uri: string;
161
+ node: Value;
162
+ /** fn:put's $params, or undefined. */
163
+ parameters: Value | undefined;
164
+ /** The node serialized with parameters (method xml without). */
165
+ serialize(): string;
166
+ /** The same, written to sink a chunk at a time (D294). */
167
+ serializeTo(sink: OutputSink): void;
168
+ }
169
+ /** Receives what an updating query changed, after the evaluation and in
170
+ * the order of each tree's first update; documents fn:put stores come
171
+ * last. Without putDocument, fn:put raises FOUP0002. */
172
+ export interface UpdateSink {
173
+ updatedTree?(tree: UpdatedTree): void;
174
+ putDocument?(document: PutDocument): void;
175
+ }
176
+ export interface QueryEvaluateOptions {
177
+ /** The initial context value; absent means none (XPDY0002 when the
178
+ * query needs it). */
179
+ context?: Input;
180
+ /** The external variables the prolog declares (XQuery 4.0, 5.16), by
181
+ * NCName or Q{uri}local; names it does not declare are ignored, and a
182
+ * declared one without a value takes its default. */
183
+ variables?: Record<string, Input>;
184
+ /** For an updating query: receives the changed trees. Without it, its
185
+ * values are disposed at once. */
186
+ updates?: UpdateSink;
187
+ /** Receives fn:trace and fn:message output, after the evaluation (also
188
+ * when it throws). */
189
+ messages?: (message: Message) => void;
190
+ }
191
+ export interface StylesheetCompileOptions {
192
+ /** The principal module's URI, against which xsl:include, xsl:import
193
+ * and fn:doc resolve. */
194
+ baseUri?: string;
195
+ /** Static parameters (XSLT 4.0, 9.6), by NCName or Q{uri}local. */
196
+ staticParameters?: Record<string, Input>;
197
+ }
198
+ /** How a result reaches you (XSLT 4.0, 2.4.6): 'serialized' as a string,
199
+ * 'raw' as the value the stylesheet made, 'tree' as one document node. */
200
+ export type ResultDelivery = 'serialized' | 'raw' | 'tree';
201
+ export interface TransformOptions {
202
+ /** The global context item (XSLT 4.0, 2.4.2): its document is the
203
+ * default initial match selection. */
204
+ source?: Input;
205
+ /** The initial match selection, when it is not the source. */
206
+ initialMatchSelection?: Input;
207
+ /** The initial mode, by NCName or Q{uri}local; '#unnamed' is the unnamed
208
+ * mode. Default: the stylesheet's default mode. */
209
+ initialMode?: string;
210
+ /** Calls this named template instead of applying templates (2.4.4).
211
+ * Without source and initialMatchSelection, xsl:initial-template is
212
+ * called. */
213
+ initialTemplate?: string;
214
+ /** Calls this stylesheet function with args instead (2.4.5). */
215
+ initialFunction?: string;
216
+ args?: Input[];
217
+ /** The stylesheet parameters. */
218
+ parameters?: Record<string, Input>;
219
+ /** Parameters of the initial template or of the template rules. */
220
+ templateParameters?: Record<string, Input>;
221
+ tunnelParameters?: Record<string, Input>;
222
+ /** Against which relative hrefs of xsl:result-document resolve. */
223
+ baseOutputUri?: string;
224
+ /** The principal result's delivery; default 'serialized', by the
225
+ * stylesheet's unnamed xsl:output. */
226
+ delivery?: ResultDelivery;
227
+ /** The result documents' delivery; default 'serialized'. */
228
+ resultDocumentDelivery?: ResultDelivery;
229
+ /** Serialization parameters replacing the unnamed xsl:output's, as
230
+ * fn:serialize takes them. */
231
+ serialization?: SerializationOptions;
232
+ /** Receives xsl:message and xsl:assert output, after the
233
+ * transformation (also when it throws). */
234
+ messages?: (message: Message) => void;
235
+ /** With delivery 'serialized': receives the principal result a chunk at
236
+ * a time as it is serialized, instead of TransformResult.output (D294). */
237
+ output?: OutputSink;
238
+ /** With resultDocumentDelivery 'serialized': chooses the sink of each
239
+ * result document by its URI, as it begins; undefined gathers it as
240
+ * ResultDocument.output. A document whose transformation fails while it
241
+ * is open is aborted. Documents with a sink are not in
242
+ * TransformResult.resultDocuments. */
243
+ resultDocumentOutput?: (uri: string) => OutputSink | undefined;
244
+ /** The absolute URI of a principal source to stream (XSLT 4.0, 2.4.3;
245
+ * D228): the resolver is asked for it (kind 'xml-document') and may
246
+ * answer with a ChunkSource. When the initial mode is streamable, its
247
+ * nodes are read as they are parsed and never held whole; otherwise it
248
+ * is built first. Applies templates; not with source or
249
+ * initialMatchSelection. */
250
+ streamedSource?: string;
251
+ }
252
+ /** A secondary result: what one xsl:result-document made (26.2). */
253
+ export interface ResultDocument {
254
+ /** Its href resolved against the base output URI. */
255
+ uri: string;
256
+ /** 'serialized': the text. */
257
+ output: string | undefined;
258
+ /** 'raw' and 'tree': the value. */
259
+ value: Value | undefined;
260
+ }
261
+ export interface TransformResult {
262
+ /** The principal result serialized ('serialized'). */
263
+ output: string | undefined;
264
+ /** The principal result as a value ('raw', 'tree'). */
265
+ value: Value | undefined;
266
+ /** In the order they completed. */
267
+ resultDocuments: ResultDocument[];
268
+ }
269
+ /** A schema document: its text, with its URI, or only a URI, which the
270
+ * resolver is asked for (kind 'schema-document'). */
271
+ export interface SchemaDocument {
272
+ text?: string | Uint8Array;
273
+ uri?: string;
274
+ }
275
+ export interface SchemaCompileOptions {
276
+ /** Against which relative URIs of documents given by URI resolve. */
277
+ baseUri?: string;
278
+ }
279
+ /** One error of a compilation or validation (XSD 1.1 Part 1, appendix
280
+ * C): code is the constraint name, such as 'cvc-complex-type.2.4'. */
281
+ export interface SchemaReport {
282
+ code: string;
283
+ description: string;
284
+ /** The schema document's URI, or the instance's. */
285
+ sourceName: string;
286
+ lineNumber: number;
287
+ columnNumber: number;
288
+ }
289
+ export interface ValidateOptions {
290
+ /** 'strict' (default): the root needs a global declaration; 'lax'. */
291
+ mode?: 'strict' | 'lax';
292
+ /** Validate the root against this type of the schema instead, by NCName
293
+ * or Q{uri}local. */
294
+ type?: string;
295
+ /** The document URI of text input. */
296
+ uri?: string;
297
+ }
298
+ /** The validity of the validation root (Part 1, 3.3.5.1). */
299
+ export type Validity = 'valid' | 'invalid' | 'not-known';
300
+ export interface ValidationResult {
301
+ validity: Validity;
302
+ /** Every error found, in order; empty when valid. */
303
+ reports: SchemaReport[];
304
+ /** Unless invalid: the validated copy, its elements and attributes
305
+ * annotated with their types (XDM 4.0, 3.3). */
306
+ document: Value | undefined;
307
+ }
308
+ /** A failure in sxml: a static, dynamic or type error of the expression
309
+ * (with its error code), a document that is not well-formed, a limit, or
310
+ * out of memory. */
311
+ export declare class SxmlError extends Error {
312
+ /** The status, such as 'DYNAMIC_ERROR' or 'MALFORMED_INPUT'. */
313
+ readonly status: string;
314
+ /** The error code as prefix:local, such as 'err:FOAR0001'; '' when the
315
+ * status has none. */
316
+ readonly code: string;
317
+ readonly codeNamespaceUri: string;
318
+ readonly codeLocalName: string;
319
+ readonly description: string;
320
+ /** The module or document the location is in: 'expression', 'query',
321
+ * a module's URI; '' when unknown. */
322
+ readonly sourceName: string;
323
+ readonly lineNumber: number;
324
+ readonly columnNumber: number;
325
+ constructor(fields: {
326
+ status: string;
327
+ codeNamespaceUri: string;
328
+ codeLocalName: string;
329
+ codePrefix: string;
330
+ description: string;
331
+ sourceName?: string;
332
+ lineNumber: number;
333
+ columnNumber: number;
334
+ });
335
+ }
336
+ /** A schema that does not compile: every error, with the first as the
337
+ * SxmlError's own code, description and location. */
338
+ export declare class SchemaError extends SxmlError {
339
+ readonly reports: readonly SchemaReport[];
340
+ constructor(error: SxmlError, reports: SchemaReport[]);
341
+ }
342
+ /** The loaded module: makes processors. One per page or process is enough;
343
+ * processors made from it are independent. */
344
+ export declare class Sxml {
345
+ /** The library version, such as '0.2.0'. */
346
+ readonly version: string;
347
+ /** The optional features of the module: all of them (D272; 'test' adds
348
+ * nothing, it checks that the list reaches the processor). */
349
+ readonly features: readonly string[];
350
+ private readonly registry;
351
+ createProcessor(options?: ProcessorOptions): Processor;
352
+ /**
353
+ * Loads a tree-sitter language file (tree-sitter-NAME.wasm, as
354
+ * `tree-sitter build --wasm` writes it) into this module for
355
+ * sxml:parse-code: links it into sxml.wasm (src/linker.ts) and checks
356
+ * its ABI and queries. Give it to processors with createProcessor({
357
+ * codeLanguages }). It stays loaded as long as this Sxml. Rejects with
358
+ * an Error that says what is wrong with the file, the name or a query.
359
+ */
360
+ loadCodeLanguage(options: CodeLanguageOptions): Promise<CodeLanguage>;
361
+ }
362
+ /** A tree-sitter language loaded by Sxml.loadCodeLanguage, for
363
+ * createProcessor({ codeLanguages }). */
364
+ export declare class CodeLanguage {
365
+ /** Its name in sxml:parse-code. */
366
+ readonly name: string;
367
+ /** The grammar's tree-sitter language ABI, 13 to 15. */
368
+ readonly abiVersion: number;
369
+ }
370
+ /** Loads and instantiates sxml.wasm. */
371
+ export declare function load(options?: LoadOptions): Promise<Sxml>;
372
+ /** A processor (include/sxml/processor.h): its name pool, types and items.
373
+ * Values and expressions belong to the processor that made them. */
374
+ export declare class Processor {
375
+ private readonly state;
376
+ /** Parses an XML document and returns its document node. */
377
+ parse(xml: string | Uint8Array, options?: {
378
+ uri?: string;
379
+ }): Value;
380
+ /** Compiles an XPath 4.0 expression, for evaluating it many times. */
381
+ compile(expression: string, options?: CompileOptions): XPathExpression;
382
+ /** Compiles and evaluates an expression once; the variables are those
383
+ * options.variables names. */
384
+ evaluate(expression: string, options?: StaticOptions & EvaluateOptions): Value;
385
+ /** Compiles an XQuery 4.0 main module, with the library modules it
386
+ * imports (the resolver is asked for them, kind 'xquery-module'), for
387
+ * evaluating it many times. */
388
+ compileQuery(query: string, options?: QueryCompileOptions): XQuery;
389
+ /** Compiles an XSLT 4.0 stylesheet, with the modules it includes and
390
+ * imports (kind 'xslt-module') and the packages it uses (kind
391
+ * 'xslt-package'), for running it many times. */
392
+ compileStylesheet(stylesheet: string | Uint8Array, options?: StylesheetCompileOptions): Stylesheet;
393
+ /** Compiles an XSD 1.1 schema from one or more schema documents (a
394
+ * string is a document's text), with every document they include,
395
+ * import, redefine or override (the resolver is asked, kind
396
+ * 'schema-document'). Throws a SchemaError with every report when the
397
+ * schema has errors. */
398
+ compileSchema(documents: string | SchemaDocument | (string | SchemaDocument)[], options?: SchemaCompileOptions): Schema;
399
+ /** Converts JSON-like data to a value (see JsonData). */
400
+ value(data: Input): Value;
401
+ /** Serializes a value: by the adaptive method without options, else as
402
+ * fn:serialize with them (method xml unless they name another). */
403
+ serialize(value: Value, options?: SerializationOptions): string;
404
+ /** Serializes a value as serialize() does, writing the output to sink a
405
+ * chunk at a time instead of returning it (D294). */
406
+ serializeTo(value: Value, sink: OutputSink, options?: SerializationOptions): void;
407
+ /** Releases the processor and every value and expression made with it. */
408
+ dispose(): void;
409
+ /** The allocations the processor holds, for leak checks in tests; after
410
+ * dispose(), those that were left when it was destroyed (0 unless the
411
+ * package or sxml leaked). */
412
+ liveAllocationCount(): number;
413
+ serializeWith(value: Value, options: Value | undefined, sink: OutputSink): void;
414
+ }
415
+ /** A compiled XPath 4.0 expression (include/sxml/xpath.h). */
416
+ export declare class XPathExpression {
417
+ readonly processor: Processor;
418
+ /** The external variables, in the order compile() was given them. */
419
+ readonly variables: readonly string[];
420
+ private handle;
421
+ /** Evaluates the expression; the result is a new value. */
422
+ evaluate(options?: EvaluateOptions): Value;
423
+ dispose(): void;
424
+ }
425
+ /** A compiled XQuery 4.0 main module (include/sxml/xquery.h).
426
+ * Processor.compileQuery makes it. */
427
+ export declare class XQuery {
428
+ readonly processor: Processor;
429
+ /** Whether its body is an updating expression (XQUF 3.0, 2.2): its
430
+ * result is then empty and its changes go to options.updates. */
431
+ readonly isUpdating: boolean;
432
+ private handle;
433
+ /** Evaluates the query; the result is a new value. */
434
+ evaluate(options?: QueryEvaluateOptions): Value;
435
+ /** Serializes a value with the serialization parameters the query's
436
+ * output declarations give (XQuery 4.0, 5.22: method xml unless they
437
+ * name another). Value.serialize(options) uses options instead. */
438
+ serialize(value: Value): string;
439
+ /** Serializes a value as serialize() does, writing the output to sink a
440
+ * chunk at a time instead of returning it (D294). */
441
+ serializeTo(value: Value, sink: OutputSink): void;
442
+ /** Evaluates the query and serializes its result as serialize() does. */
443
+ run(options?: QueryEvaluateOptions): string;
444
+ /** Evaluates the query and writes its serialized result to sink a chunk
445
+ * at a time, as serializeTo() does (D294). */
446
+ runTo(sink: OutputSink, options?: QueryEvaluateOptions): void;
447
+ private serializeOutput;
448
+ dispose(): void;
449
+ private address;
450
+ }
451
+ /** A compiled XSLT 4.0 stylesheet (include/sxml/xslt.h).
452
+ * Processor.compileStylesheet makes it. */
453
+ export declare class Stylesheet {
454
+ readonly processor: Processor;
455
+ private handle;
456
+ /** Runs one transformation (XSLT 4.0, 2.3): applies templates to the
457
+ * source, or calls options.initialTemplate or options.initialFunction. */
458
+ transform(options?: TransformOptions): TransformResult;
459
+ dispose(): void;
460
+ private address;
461
+ }
462
+ /** A compiled XSD 1.1 schema (include/sxml/schema.h).
463
+ * Processor.compileSchema makes it. */
464
+ export declare class Schema {
465
+ readonly processor: Processor;
466
+ private handle;
467
+ /** Validates a document (XSD 1.1 Part 1, 5.2): XML text, parsed and
468
+ * validated in one pass so that reports have its lines and columns, or
469
+ * a document or element node of this processor. An invalid document is
470
+ * not an exception: see the result's validity and reports. Text that
471
+ * is not well-formed throws, as Processor.parse does. */
472
+ validate(input: Value | string | Uint8Array, options?: ValidateOptions): ValidationResult;
473
+ dispose(): void;
474
+ private address;
475
+ }
476
+ /** An XDM value: a sequence of items in its processor (a parsed document,
477
+ * an evaluation's result). */
478
+ export declare class Value {
479
+ readonly processor: Processor;
480
+ private handle;
481
+ /** Serializes the value (Processor.serialize). */
482
+ serialize(options?: SerializationOptions): string;
483
+ /** Serializes the value to sink a chunk at a time
484
+ * (Processor.serializeTo). */
485
+ serializeTo(sink: OutputSink, options?: SerializationOptions): void;
486
+ /** The value by the adaptive method: items one per line, strings
487
+ * quoted, nodes as XML. */
488
+ toString(): string;
489
+ dispose(): void;
490
+ }