forked from noppa/xmllint-wasm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
51 lines (45 loc) · 1.34 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
export type XMLString = string;
export type XMLFileInfo = {
readonly fileName: string;
readonly contents: XMLString;
};
export type XMLInput = XMLString | XMLFileInfo;
export type XMLLintOptions = {
/**
* XML file contents to validate.
* Note that xmllint only supports UTF-8 encoded files.
*/
readonly xml: XMLInput | ReadonlyArray<XMLInput>;
readonly schema: XMLInput | ReadonlyArray<XMLInput>;
/**
* Other files that should be added to Emscripten's in-memory
* file system so that xmllint can access them.
* Useful if your schema contains imports.
*/
readonly preload?: null | undefined | XMLFileInfo | ReadonlyArray<XMLFileInfo>;
/**
* @default 'schema'
*/
readonly extension?: 'schema' | 'relaxng',
};
export type XMLValidationError = {
readonly rawMessage: string;
/**
* Error message without the file name and line number.
*/
readonly message: string;
/**
* Position of the error.
* null if we failed to parse the position from the raw message for some reason.
*/
readonly loc: null | {
readonly fileName: string;
readonly lineNumber: number;
};
};
export type XMLValidationResult = {
readonly valid: boolean;
readonly errors: ReadonlyArray<XMLValidationError>;
readonly rawOutput: string;
}
export function validateXML(options: XMLLintOptions): Promise<XMLValidationResult>;