1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export = xml2js;
|
9 |
|
10 | import * as events from 'events'
|
11 |
|
12 | declare namespace xml2js {
|
13 | function parseString(xml: convertableToString, callback: (err: any, result: any) => void): void;
|
14 | function parseString(xml: convertableToString, options: OptionsV2, callback: (err: any, result: any) => void): void;
|
15 |
|
16 | var defaults: {
|
17 | '0.1': Options;
|
18 | '0.2': OptionsV2;
|
19 | }
|
20 |
|
21 | class Builder {
|
22 | constructor(options?: OptionsV2);
|
23 | buildObject(rootObj: any): string;
|
24 | }
|
25 |
|
26 | class Parser extends events.EventEmitter {
|
27 | constructor(options?: OptionsV2);
|
28 | parseString(str: convertableToString, cb?: Function): void;
|
29 | reset(): void;
|
30 | }
|
31 |
|
32 | interface Options {
|
33 | async?: boolean;
|
34 | attrkey?: string;
|
35 | attrNameProcessors?: [(name: string) => any];
|
36 | attrValueProcessors?: [(name: string) => any];
|
37 | charkey?: string;
|
38 | charsAsChildren?: boolean;
|
39 | childkey?: string;
|
40 | emptyTag?: any;
|
41 | explicitArray?: boolean;
|
42 | explicitCharkey?: boolean;
|
43 | explicitChildren?: boolean;
|
44 | explicitRoot?: boolean;
|
45 | ignoreAttrs?: boolean;
|
46 | includeWhiteChars?: boolean;
|
47 | mergeAttrs?: boolean;
|
48 | normalize?: boolean;
|
49 | normalizeTags?: boolean;
|
50 | strict?: boolean;
|
51 | tagNameProcessors?: [(name: string) => any];
|
52 | trim?: boolean;
|
53 | validator?: Function;
|
54 | valueProcessors?: [(name: string) => any];
|
55 | xmlns?: boolean;
|
56 | }
|
57 |
|
58 | interface OptionsV2 extends Options {
|
59 | preserveChildrenOrder?: boolean;
|
60 | rootName?: string;
|
61 | xmldec?: {
|
62 | version: string;
|
63 | encoding?: string;
|
64 | standalone?: boolean;
|
65 | };
|
66 | doctype?: any;
|
67 | renderOpts?: {
|
68 | pretty?: boolean;
|
69 | indent?: string;
|
70 | newline?: string;
|
71 | };
|
72 | headless?: boolean;
|
73 | chunkSize?: number;
|
74 | cdata?: boolean;
|
75 | }
|
76 |
|
77 | interface convertableToString {
|
78 | toString(): string;
|
79 | }
|
80 | }
|