forked from NaturalIntelligence/fast-xml-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfxp.d.ts
89 lines (84 loc) · 2.71 KB
/
fxp.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
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
88
89
type X2jOptions = {
preserveOrder: boolean;
attributeNamePrefix: string;
attributesGroupName: false | string;
textNodeName: string;
ignoreAttributes: boolean;
removeNSPrefix: boolean;
allowBooleanAttributes: boolean;
parseTagValue: boolean;
parseAttributeValue: boolean;
trimValues: boolean;
cdataPropName: false | string;
commentPropName: false | string;
tagValueProcessor: (tagName: string, tagValue: string, jPath: string, hasAttributes: boolean, isLeafNode: boolean) => string;
attributeValueProcessor: (attrName: string, attrValue: string, jPath: string) => string;
numberParseOptions: strnumOptions;
stopNodes: string[];
unpairedTags: string[];
alwaysCreateTextNode: boolean;
isArray: (tagName: string, jPath: string, isLeafNode: boolean, isAttribute: boolean) => boolean;
processEntities: boolean;
htmlEntities: boolean;
ignoreDeclaration: boolean;
ignorePiTags: boolean;
transformTagName: ((tagName: string) => string) | false;
};
type strnumOptions = {
hex: boolean;
leadingZeros: boolean,
skipLike?: RegExp
}
type X2jOptionsOptional = Partial<X2jOptions>;
type validationOptions = {
allowBooleanAttributes: boolean;
unpairedTags: string[];
};
type validationOptionsOptional = Partial<validationOptions>;
type XmlBuilderOptions = {
attributeNamePrefix: string;
attributesGroupName: false | string;
textNodeName: string;
ignoreAttributes: boolean;
cdataPropName: false | string;
commentPropName: false | string;
format: boolean;
indentBy: string;
arrayNodeName: string;
suppressEmptyNode: boolean;
suppressUnpairedNode: boolean;
suppressBooleanAttributes: boolean;
preserveOrder: boolean;
unpairedTags: string[];
stopNodes: string[];
tagValueProcessor: (name: string, value: string) => string;
attributeValueProcessor: (name: string, value: string) => string;
processEntities: boolean;
};
type XmlBuilderOptionsOptional = Partial<XmlBuilderOptions>;
type ESchema = string | object | Array<string|object>;
type ValidationError = {
err: {
code: string;
msg: string,
line: number,
col: number
};
};
export class XMLParser {
constructor(options?: X2jOptionsOptional);
parse(xmlData: string | Buffer ,validationOptions?: validationOptionsOptional | boolean): any;
/**
* Add Entity which is not by default supported by this library
* @param entityIndentifier {string} Eg: 'ent' for &ent;
* @param entityValue {string} Eg: '\r'
*/
addEntity(entityIndentifier: string, entityValue: string): void;
}
export class XMLValidator{
static validate( xmlData: string, options?: validationOptionsOptional): true | ValidationError;
}
export class XMLBuilder {
constructor(options: XmlBuilderOptionsOptional);
build(jObj: any): any;
}