forked from noppa/xmllint-wasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js.flow
53 lines (46 loc) · 1.25 KB
/
index.js.flow
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
52
53
// @flow
export type XMLString = string;
export type XMLFileInfo = {|
+fileName: string;
+contents: XMLString;
|};
export type XMLInput = XMLString | XMLFileInfo;
export type XMLLintOptions = {|
/**
* XML file contents to validate.
* Note that xmllint only supports UTF-8 encoded files.
*/
+xml: XMLInput | $ReadOnlyArray<XMLInput>;
+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.
*/
+preload?: ?(XMLFileInfo | $ReadOnlyArray<XMLFileInfo>);
/**
* @default 'schema'
*/
+extension?: 'schema' | 'relaxng',
|};
export type XMLValidationError = {|
+rawMessage: string;
/**
* Error message without the file name and line number.
*/
+message: string;
/**
* Position of the error.
* null if we failed to parse the position from the raw message for some reason.
*/
+loc: null | {|
+fileName: string;
+lineNumber: number;
|};
|};
export type XMLValidationResult = {|
+valid: boolean;
+errors: $ReadOnlyArray<XMLValidationError>;
+rawOutput: string;
|}
declare export function validateXML(options: XMLLintOptions): Promise<XMLValidationResult>;