forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xml2json.d.ts
43 lines (35 loc) · 1.22 KB
/
xml2json.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
// Type definitions for x2js
// Project: https://code.google.com/p/x2js/
// Definitions by: Horiuchi_H <https://github.com/horiuchi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Fork to use with Fork of x2js: https://github.com/anvog/x2js/tree/Feature-keepOrder
// Original sources are available at https://github.com/anvog/DefinitelyTyped
interface IX2JS {
new (config?: IX2JSOption): IX2JS;
getVersion(): string;
xml2json<T>(dom: Node): T;
json2xml<T>(json: T): Node;
xml_str2json<T>(xml: string): T;
json2xml_str<T>(json: T): string;
parseXmlString(xml: string): Node;
asArray(prop: any): any[];
asDateTime(key: string): string;
asXmlDateTime(date: Date): string;
asXmlDateTime(date: number): string;
}
interface IX2JSOption {
escapeMode?: boolean;
attributePrefix?: string;
arrayAccessForm?: string;
emptyNodeForm?: string;
enableToStringFunc?: boolean;
arrayAccessFormPaths?: any[];
skipEmptyTextNodesForObj?: boolean;
stripWhitespaces?: boolean;
datetimeAccessFormPaths?: any[];
// Added for x2js Fork: https://github.com/anvog/x2js/tree/Feature-keepOrder
keepOrder?: boolean;
orderContainerName?: string;
arrayOrderItems?: any[];
}
declare var X2JS: IX2JS;