333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Type definitions for node-xml2js 0.4
// Project: https://github.com/Leonidas-from-XIV/node-xml2js
// Definitions by: Michel Salib <https://github.com/michelsalib>
//                 Jason McNeil <https://github.com/jasonrm>
//                 Christopher Currens <https://github.com/ccurrens>
//                 Edward Hinkle <https://github.com/edwardhinkle>
//                 Behind The Math <https://github.com/BehindTheMath>
//                 Claas Ahlrichs <https://github.com/claasahl>
//                 Grzegorz Redlicki <https://github.com/redlickigrzegorz>
//                 Ryan Ling <https://github.com/72636c>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
 
/// <reference types="node"/>
import { EventEmitter } from 'events';
import * as processors from './lib/processors';
 
export function parseString(str: convertableToString, callback: (err: Error, result: any) => void): void;
export function parseString(str: convertableToString, options: OptionsV2, callback: (err: Error, result: any) => void): void;
export function parseStringPromise(str: convertableToString, options?: OptionsV2): Promise<any>;
 
export const defaults: {
    '0.1': Options;
    '0.2': OptionsV2;
};
 
export class Builder {
    constructor(options?: OptionsV2);
    buildObject(rootObj: any): string;
}
 
export class Parser extends EventEmitter {
    constructor(options?: OptionsV2);
    parseString(str: convertableToString, cb?: Function): void;
    parseStringPromise(str: convertableToString): Promise<any>;
    reset(): void;
}
 
export interface Options {
    async?: boolean;
    attrkey?: string;
    attrNameProcessors?: Array<(name: string) => any>;
    attrValueProcessors?: Array<(value: string, name: string) => any>;
    charkey?: string;
    charsAsChildren?: boolean;
    childkey?: string;
    emptyTag?: any;
    explicitArray?: boolean;
    explicitCharkey?: boolean;
    explicitChildren?: boolean;
    explicitRoot?: boolean;
    ignoreAttrs?: boolean;
    includeWhiteChars?: boolean;
    mergeAttrs?: boolean;
    normalize?: boolean;
    normalizeTags?: boolean;
    strict?: boolean;
    tagNameProcessors?: Array<(name: string) => any>;
    trim?: boolean;
    validator?: Function;
    valueProcessors?: Array<(value: string, name: string) => any>;
    xmlns?: boolean;
}
 
export interface OptionsV2 extends Options {
    preserveChildrenOrder?: boolean;
    rootName?: string;
    xmldec?: {
        version: string;
        encoding?: string;
        standalone?: boolean;
    };
    doctype?: any;
    renderOpts?: {
        pretty?: boolean;
        indent?: string;
        newline?: string;
    };
    headless?: boolean;
    chunkSize?: number;
    cdata?: boolean;
}
 
export interface convertableToString {
    toString(): string;
}
 
export { processors };