@cdk8s/awscdk-resolver 0.0.470 → 0.0.472
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +4 -4
- package/lib/resolve.js +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/LICENSE +201 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/README.md +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js +415 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partitions.json +267 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/aws.js +10 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/index.js +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/index.js +3 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/isVirtualHostableS3Bucket.js +25 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/parseArn.js +18 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/partition.js +41 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/partitions.json +267 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/lib/isIpAddress.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/resolveDefaultAwsRegionalEndpointsConfig.js +21 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/resolveEndpoint.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/types/EndpointError.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/types/EndpointRuleObject.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/types/ErrorRuleObject.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/types/RuleSetObject.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/types/TreeRuleObject.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/types/index.js +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-es/types/shared.js +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/aws.d.ts +2 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/index.d.ts +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/lib/aws/index.d.ts +3 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/lib/aws/isVirtualHostableS3Bucket.d.ts +5 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/lib/aws/parseArn.d.ts +7 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/lib/aws/partition.d.ts +38 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/lib/isIpAddress.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/resolveDefaultAwsRegionalEndpointsConfig.d.ts +56 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/resolveEndpoint.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/aws.d.ts +2 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/index.d.ts +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/lib/aws/index.d.ts +3 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/lib/aws/isVirtualHostableS3Bucket.d.ts +4 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/lib/aws/parseArn.d.ts +2 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/lib/aws/partition.d.ts +28 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/lib/isIpAddress.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/resolveDefaultAwsRegionalEndpointsConfig.d.ts +35 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/resolveEndpoint.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/EndpointError.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/EndpointRuleObject.d.ts +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/ErrorRuleObject.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/RuleSetObject.d.ts +5 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/TreeRuleObject.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/index.d.ts +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/shared.d.ts +12 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/types/EndpointError.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/types/EndpointRuleObject.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/types/ErrorRuleObject.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/types/RuleSetObject.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/types/TreeRuleObject.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/types/index.d.ts +6 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/dist-types/types/shared.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/node_modules/@aws-sdk/util-endpoints/package.json +60 -0
- package/node_modules/@aws-sdk/client-cloudformation/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +2 -2
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +2 -2
- package/node_modules/@smithy/node-http-handler/package.json +5 -5
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-stream/package.json +6 -6
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/CHANGELOG.md +16 -0
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/README.md +7 -6
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxp.d.cts +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/package.json +4 -2
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/fxp.d.ts +2 -2
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsMinArrBuilder.js +1 -1
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/ParserOptionsBuilder.js +4 -4
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +379 -0
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/OrderedObjParser.js +55 -22
- package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/XMLParser.js +4 -4
- package/package.json +4 -4
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +0 -369
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/LICENSE +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxbuilder.min.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxbuilder.min.js.map +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxvalidator.min.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxvalidator.min.js.map +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/cli.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/man.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/read.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/fxp.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/ignoreAttributes.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/util.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/CharsSymbol.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/EntitiesParser.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OptionsBuilder.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/BaseOutputBuilder.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsArrBuilder.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsObjBuilder.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/Report.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/TagPath.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/TagPathMatcher.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XMLParser.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/Xml2JsParser.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XmlPartReader.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XmlSpecialTagsReader.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/inputSource/BufferSource.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/inputSource/StringSource.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/EntitiesParser.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/booleanParser.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/booleanParserExt.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/currency.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/join.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/number.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/trim.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/validator.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlbuilder/json2xml.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlbuilder/orderedJs2Xml.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlbuilder/prettifyJs2Xml.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/OptionsBuilder.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/node2json.js +0 -0
- /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/xmlNode.js +0 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import {isName} from '../util.js';
|
|
2
|
+
|
|
3
|
+
export default class DocTypeReader{
|
|
4
|
+
constructor(processEntities){
|
|
5
|
+
this.suppressValidationErr = !processEntities;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
readDocType(xmlData, i){
|
|
9
|
+
|
|
10
|
+
const entities = {};
|
|
11
|
+
if( xmlData[i + 3] === 'O' &&
|
|
12
|
+
xmlData[i + 4] === 'C' &&
|
|
13
|
+
xmlData[i + 5] === 'T' &&
|
|
14
|
+
xmlData[i + 6] === 'Y' &&
|
|
15
|
+
xmlData[i + 7] === 'P' &&
|
|
16
|
+
xmlData[i + 8] === 'E')
|
|
17
|
+
{
|
|
18
|
+
i = i+9;
|
|
19
|
+
let angleBracketsCount = 1;
|
|
20
|
+
let hasBody = false, comment = false;
|
|
21
|
+
let exp = "";
|
|
22
|
+
for(;i<xmlData.length;i++){
|
|
23
|
+
if (xmlData[i] === '<' && !comment) { //Determine the tag type
|
|
24
|
+
if( hasBody && hasSeq(xmlData, "!ENTITY",i)){
|
|
25
|
+
i += 7;
|
|
26
|
+
let entityName, val;
|
|
27
|
+
[entityName, val,i] = this.readEntityExp(xmlData,i+1,this.suppressValidationErr);
|
|
28
|
+
if(val.indexOf("&") === -1) //Parameter entities are not supported
|
|
29
|
+
entities[ entityName ] = {
|
|
30
|
+
regx : RegExp( `&${entityName};`,"g"),
|
|
31
|
+
val: val
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else if( hasBody && hasSeq(xmlData, "!ELEMENT",i)) {
|
|
35
|
+
i += 8;//Not supported
|
|
36
|
+
const {index} = this.readElementExp(xmlData,i+1);
|
|
37
|
+
i = index;
|
|
38
|
+
}else if( hasBody && hasSeq(xmlData, "!ATTLIST",i)){
|
|
39
|
+
i += 8;//Not supported
|
|
40
|
+
// const {index} = this.readAttlistExp(xmlData,i+1);
|
|
41
|
+
// i = index;
|
|
42
|
+
}else if( hasBody && hasSeq(xmlData, "!NOTATION",i)) {
|
|
43
|
+
i += 9;//Not supported
|
|
44
|
+
const {index} = this.readNotationExp(xmlData,i+1,this.suppressValidationErr);
|
|
45
|
+
i = index;
|
|
46
|
+
}else if( hasSeq(xmlData, "!--",i) ) comment = true;
|
|
47
|
+
else throw new Error(`Invalid DOCTYPE`);
|
|
48
|
+
|
|
49
|
+
angleBracketsCount++;
|
|
50
|
+
exp = "";
|
|
51
|
+
} else if (xmlData[i] === '>') { //Read tag content
|
|
52
|
+
if(comment){
|
|
53
|
+
if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
|
|
54
|
+
comment = false;
|
|
55
|
+
angleBracketsCount--;
|
|
56
|
+
}
|
|
57
|
+
}else{
|
|
58
|
+
angleBracketsCount--;
|
|
59
|
+
}
|
|
60
|
+
if (angleBracketsCount === 0) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}else if( xmlData[i] === '['){
|
|
64
|
+
hasBody = true;
|
|
65
|
+
}else{
|
|
66
|
+
exp += xmlData[i];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if(angleBracketsCount !== 0){
|
|
70
|
+
throw new Error(`Unclosed DOCTYPE`);
|
|
71
|
+
}
|
|
72
|
+
}else{
|
|
73
|
+
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
74
|
+
}
|
|
75
|
+
return {entities, i};
|
|
76
|
+
}
|
|
77
|
+
readEntityExp(xmlData, i) {
|
|
78
|
+
//External entities are not supported
|
|
79
|
+
// <!ENTITY ext SYSTEM "http://normal-website.com" >
|
|
80
|
+
|
|
81
|
+
//Parameter entities are not supported
|
|
82
|
+
// <!ENTITY entityname "&anotherElement;">
|
|
83
|
+
|
|
84
|
+
//Internal entities are supported
|
|
85
|
+
// <!ENTITY entityname "replacement text">
|
|
86
|
+
|
|
87
|
+
// Skip leading whitespace after <!ENTITY
|
|
88
|
+
i = skipWhitespace(xmlData, i);
|
|
89
|
+
|
|
90
|
+
// Read entity name
|
|
91
|
+
let entityName = "";
|
|
92
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
|
|
93
|
+
entityName += xmlData[i];
|
|
94
|
+
i++;
|
|
95
|
+
}
|
|
96
|
+
validateEntityName(entityName);
|
|
97
|
+
|
|
98
|
+
// Skip whitespace after entity name
|
|
99
|
+
i = skipWhitespace(xmlData, i);
|
|
100
|
+
|
|
101
|
+
// Check for unsupported constructs (external entities or parameter entities)
|
|
102
|
+
if(!this.suppressValidationErr){
|
|
103
|
+
if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
|
|
104
|
+
throw new Error("External entities are not supported");
|
|
105
|
+
}else if (xmlData[i] === "%") {
|
|
106
|
+
throw new Error("Parameter entities are not supported");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Read entity value (internal entity)
|
|
111
|
+
let entityValue = "";
|
|
112
|
+
[i, entityValue] = this.readIdentifierVal(xmlData, i, "entity");
|
|
113
|
+
i--;
|
|
114
|
+
return [entityName, entityValue, i ];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
readNotationExp(xmlData, i) {
|
|
118
|
+
// Skip leading whitespace after <!NOTATION
|
|
119
|
+
i = skipWhitespace(xmlData, i);
|
|
120
|
+
|
|
121
|
+
// Read notation name
|
|
122
|
+
let notationName = "";
|
|
123
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
124
|
+
notationName += xmlData[i];
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
!this.suppressValidationErr && validateEntityName(notationName);
|
|
128
|
+
|
|
129
|
+
// Skip whitespace after notation name
|
|
130
|
+
i = skipWhitespace(xmlData, i);
|
|
131
|
+
|
|
132
|
+
// Check identifier type (SYSTEM or PUBLIC)
|
|
133
|
+
const identifierType = xmlData.substring(i, i + 6).toUpperCase();
|
|
134
|
+
if (!this.suppressValidationErr && identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
|
|
135
|
+
throw new Error(`Expected SYSTEM or PUBLIC, found "${identifierType}"`);
|
|
136
|
+
}
|
|
137
|
+
i += identifierType.length;
|
|
138
|
+
|
|
139
|
+
// Skip whitespace after identifier type
|
|
140
|
+
i = skipWhitespace(xmlData, i);
|
|
141
|
+
|
|
142
|
+
// Read public identifier (if PUBLIC)
|
|
143
|
+
let publicIdentifier = null;
|
|
144
|
+
let systemIdentifier = null;
|
|
145
|
+
|
|
146
|
+
if (identifierType === "PUBLIC") {
|
|
147
|
+
[i, publicIdentifier ] = this.readIdentifierVal(xmlData, i, "publicIdentifier");
|
|
148
|
+
|
|
149
|
+
// Skip whitespace after public identifier
|
|
150
|
+
i = skipWhitespace(xmlData, i);
|
|
151
|
+
|
|
152
|
+
// Optionally read system identifier
|
|
153
|
+
if (xmlData[i] === '"' || xmlData[i] === "'") {
|
|
154
|
+
[i, systemIdentifier ] = this.readIdentifierVal(xmlData, i,"systemIdentifier");
|
|
155
|
+
}
|
|
156
|
+
} else if (identifierType === "SYSTEM") {
|
|
157
|
+
// Read system identifier (mandatory for SYSTEM)
|
|
158
|
+
[i, systemIdentifier ] = this.readIdentifierVal(xmlData, i, "systemIdentifier");
|
|
159
|
+
|
|
160
|
+
if (!this.suppressValidationErr && !systemIdentifier) {
|
|
161
|
+
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return {notationName, publicIdentifier, systemIdentifier, index: --i};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
readIdentifierVal(xmlData, i, type) {
|
|
169
|
+
let identifierVal = "";
|
|
170
|
+
const startChar = xmlData[i];
|
|
171
|
+
if (startChar !== '"' && startChar !== "'") {
|
|
172
|
+
throw new Error(`Expected quoted string, found "${startChar}"`);
|
|
173
|
+
}
|
|
174
|
+
i++;
|
|
175
|
+
|
|
176
|
+
while (i < xmlData.length && xmlData[i] !== startChar) {
|
|
177
|
+
identifierVal += xmlData[i];
|
|
178
|
+
i++;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (xmlData[i] !== startChar) {
|
|
182
|
+
throw new Error(`Unterminated ${type} value`);
|
|
183
|
+
}
|
|
184
|
+
i++;
|
|
185
|
+
return [i, identifierVal];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
readElementExp(xmlData, i) {
|
|
189
|
+
// <!ELEMENT br EMPTY>
|
|
190
|
+
// <!ELEMENT div ANY>
|
|
191
|
+
// <!ELEMENT title (#PCDATA)>
|
|
192
|
+
// <!ELEMENT book (title, author+)>
|
|
193
|
+
// <!ELEMENT name (content-model)>
|
|
194
|
+
|
|
195
|
+
// Skip leading whitespace after <!ELEMENT
|
|
196
|
+
i = skipWhitespace(xmlData, i);
|
|
197
|
+
|
|
198
|
+
// Read element name
|
|
199
|
+
let elementName = "";
|
|
200
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
201
|
+
elementName += xmlData[i];
|
|
202
|
+
i++;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Validate element name
|
|
206
|
+
if (!this.suppressValidationErr && !isName(elementName)) {
|
|
207
|
+
throw new Error(`Invalid element name: "${elementName}"`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Skip whitespace after element name
|
|
211
|
+
i = skipWhitespace(xmlData, i);
|
|
212
|
+
let contentModel = "";
|
|
213
|
+
// Expect '(' to start content model
|
|
214
|
+
if(xmlData[i] === "E" && hasSeq(xmlData, "MPTY",i)) i+=4;
|
|
215
|
+
else if(xmlData[i] === "A" && hasSeq(xmlData, "NY",i)) i+=2;
|
|
216
|
+
else if (xmlData[i] === "(") {
|
|
217
|
+
i++; // Move past '('
|
|
218
|
+
|
|
219
|
+
// Read content model
|
|
220
|
+
while (i < xmlData.length && xmlData[i] !== ")") {
|
|
221
|
+
contentModel += xmlData[i];
|
|
222
|
+
i++;
|
|
223
|
+
}
|
|
224
|
+
if (xmlData[i] !== ")") {
|
|
225
|
+
throw new Error("Unterminated content model");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
}else if(!this.suppressValidationErr){
|
|
229
|
+
throw new Error(`Invalid Element Expression, found "${xmlData[i]}"`);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
elementName,
|
|
234
|
+
contentModel: contentModel.trim(),
|
|
235
|
+
index: i
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
readAttlistExp(xmlData, i) {
|
|
240
|
+
// Skip leading whitespace after <!ATTLIST
|
|
241
|
+
i = skipWhitespace(xmlData, i);
|
|
242
|
+
|
|
243
|
+
// Read element name
|
|
244
|
+
let elementName = "";
|
|
245
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
246
|
+
elementName += xmlData[i];
|
|
247
|
+
i++;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Validate element name
|
|
251
|
+
validateEntityName(elementName)
|
|
252
|
+
|
|
253
|
+
// Skip whitespace after element name
|
|
254
|
+
i = skipWhitespace(xmlData, i);
|
|
255
|
+
|
|
256
|
+
// Read attribute name
|
|
257
|
+
let attributeName = "";
|
|
258
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
259
|
+
attributeName += xmlData[i];
|
|
260
|
+
i++;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Validate attribute name
|
|
264
|
+
if (!validateEntityName(attributeName)) {
|
|
265
|
+
throw new Error(`Invalid attribute name: "${attributeName}"`);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Skip whitespace after attribute name
|
|
269
|
+
i = skipWhitespace(xmlData, i);
|
|
270
|
+
|
|
271
|
+
// Read attribute type
|
|
272
|
+
let attributeType = "";
|
|
273
|
+
if (xmlData.substring(i, i + 8).toUpperCase() === "NOTATION") {
|
|
274
|
+
attributeType = "NOTATION";
|
|
275
|
+
i += 8; // Move past "NOTATION"
|
|
276
|
+
|
|
277
|
+
// Skip whitespace after "NOTATION"
|
|
278
|
+
i = skipWhitespace(xmlData, i);
|
|
279
|
+
|
|
280
|
+
// Expect '(' to start the list of notations
|
|
281
|
+
if (xmlData[i] !== "(") {
|
|
282
|
+
throw new Error(`Expected '(', found "${xmlData[i]}"`);
|
|
283
|
+
}
|
|
284
|
+
i++; // Move past '('
|
|
285
|
+
|
|
286
|
+
// Read the list of allowed notations
|
|
287
|
+
let allowedNotations = [];
|
|
288
|
+
while (i < xmlData.length && xmlData[i] !== ")") {
|
|
289
|
+
let notation = "";
|
|
290
|
+
while (i < xmlData.length && xmlData[i] !== "|" && xmlData[i] !== ")") {
|
|
291
|
+
notation += xmlData[i];
|
|
292
|
+
i++;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Validate notation name
|
|
296
|
+
notation = notation.trim();
|
|
297
|
+
if (!validateEntityName(notation)) {
|
|
298
|
+
throw new Error(`Invalid notation name: "${notation}"`);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
allowedNotations.push(notation);
|
|
302
|
+
|
|
303
|
+
// Skip '|' separator or exit loop
|
|
304
|
+
if (xmlData[i] === "|") {
|
|
305
|
+
i++; // Move past '|'
|
|
306
|
+
i = skipWhitespace(xmlData, i); // Skip optional whitespace after '|'
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (xmlData[i] !== ")") {
|
|
311
|
+
throw new Error("Unterminated list of notations");
|
|
312
|
+
}
|
|
313
|
+
i++; // Move past ')'
|
|
314
|
+
|
|
315
|
+
// Store the allowed notations as part of the attribute type
|
|
316
|
+
attributeType += " (" + allowedNotations.join("|") + ")";
|
|
317
|
+
} else {
|
|
318
|
+
// Handle simple types (e.g., CDATA, ID, IDREF, etc.)
|
|
319
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
320
|
+
attributeType += xmlData[i];
|
|
321
|
+
i++;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Validate simple attribute type
|
|
325
|
+
const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
326
|
+
if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
|
|
327
|
+
throw new Error(`Invalid attribute type: "${attributeType}"`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Skip whitespace after attribute type
|
|
332
|
+
i = skipWhitespace(xmlData, i);
|
|
333
|
+
|
|
334
|
+
// Read default value
|
|
335
|
+
let defaultValue = "";
|
|
336
|
+
if (xmlData.substring(i, i + 8).toUpperCase() === "#REQUIRED") {
|
|
337
|
+
defaultValue = "#REQUIRED";
|
|
338
|
+
i += 8;
|
|
339
|
+
} else if (xmlData.substring(i, i + 7).toUpperCase() === "#IMPLIED") {
|
|
340
|
+
defaultValue = "#IMPLIED";
|
|
341
|
+
i += 7;
|
|
342
|
+
} else {
|
|
343
|
+
[i, defaultValue] = this.readIdentifierVal(xmlData, i, "ATTLIST");
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return {
|
|
347
|
+
elementName,
|
|
348
|
+
attributeName,
|
|
349
|
+
attributeType,
|
|
350
|
+
defaultValue,
|
|
351
|
+
index: i
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
const skipWhitespace = (data, index) => {
|
|
359
|
+
while (index < data.length && /\s/.test(data[index])) {
|
|
360
|
+
index++;
|
|
361
|
+
}
|
|
362
|
+
return index;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
function hasSeq(data, seq,i){
|
|
368
|
+
for(let j=0;j<seq.length;j++){
|
|
369
|
+
if(seq[j]!==data[i+j+1]) return false;
|
|
370
|
+
}
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function validateEntityName(name){
|
|
375
|
+
if (isName(name))
|
|
376
|
+
return name;
|
|
377
|
+
else
|
|
378
|
+
throw new Error(`Invalid entity name ${name}`);
|
|
379
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import {getAllMatches, isExist} from '../util.js';
|
|
5
5
|
import xmlNode from './xmlNode.js';
|
|
6
|
-
import
|
|
6
|
+
import DocTypeReader from './DocTypeReader.js';
|
|
7
7
|
import toNumber from "strnum";
|
|
8
8
|
import getIgnoreAttributesFn from "../ignoreAttributes.js";
|
|
9
9
|
|
|
@@ -41,8 +41,8 @@ export default class OrderedObjParser{
|
|
|
41
41
|
"copyright" : { regex: /&(copy|#169);/g, val: "©" },
|
|
42
42
|
"reg" : { regex: /&(reg|#174);/g, val: "®" },
|
|
43
43
|
"inr" : { regex: /&(inr|#8377);/g, val: "₹" },
|
|
44
|
-
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) =>
|
|
45
|
-
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) =>
|
|
44
|
+
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => fromCodePoint(str, 10, "&#") },
|
|
45
|
+
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => fromCodePoint(str, 16, "&#x") },
|
|
46
46
|
};
|
|
47
47
|
this.addExternalEntities = addExternalEntities;
|
|
48
48
|
this.parseXml = parseXml;
|
|
@@ -55,6 +55,20 @@ export default class OrderedObjParser{
|
|
|
55
55
|
this.saveTextToParentTag = saveTextToParentTag;
|
|
56
56
|
this.addChild = addChild;
|
|
57
57
|
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
|
|
58
|
+
|
|
59
|
+
if(this.options.stopNodes && this.options.stopNodes.length > 0){
|
|
60
|
+
this.stopNodesExact = new Set();
|
|
61
|
+
this.stopNodesWildcard = new Set();
|
|
62
|
+
for(let i = 0; i < this.options.stopNodes.length; i++){
|
|
63
|
+
const stopNodeExp = this.options.stopNodes[i];
|
|
64
|
+
if(typeof stopNodeExp !== 'string') continue;
|
|
65
|
+
if(stopNodeExp.startsWith("*.")){
|
|
66
|
+
this.stopNodesWildcard.add(stopNodeExp.substring(2));
|
|
67
|
+
}else{
|
|
68
|
+
this.stopNodesExact.add(stopNodeExp);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
}
|
|
@@ -126,7 +140,7 @@ function resolveNameSpace(tagname) {
|
|
|
126
140
|
//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
|
|
127
141
|
const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
|
|
128
142
|
|
|
129
|
-
function buildAttributesMap(attrStr, jPath
|
|
143
|
+
function buildAttributesMap(attrStr, jPath) {
|
|
130
144
|
if (this.options.ignoreAttributes !== true && typeof attrStr === 'string') {
|
|
131
145
|
// attrStr = attrStr.replace(/\r?\n/g, ' ');
|
|
132
146
|
//attrStr = attrStr || attrStr.trim();
|
|
@@ -189,6 +203,7 @@ const parseXml = function(xmlData) {
|
|
|
189
203
|
let currentNode = xmlObj;
|
|
190
204
|
let textData = "";
|
|
191
205
|
let jPath = "";
|
|
206
|
+
const docTypeReader = new DocTypeReader(this.options.processEntities);
|
|
192
207
|
for(let i=0; i< xmlData.length; i++){//for each char in XML data
|
|
193
208
|
const ch = xmlData[i];
|
|
194
209
|
if(ch === '<'){
|
|
@@ -237,14 +252,14 @@ const parseXml = function(xmlData) {
|
|
|
237
252
|
|
|
238
253
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
239
254
|
if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags){
|
|
240
|
-
|
|
255
|
+
//do nothing
|
|
241
256
|
}else{
|
|
242
257
|
|
|
243
258
|
const childNode = new xmlNode(tagData.tagName);
|
|
244
259
|
childNode.add(this.options.textNodeName, "");
|
|
245
260
|
|
|
246
261
|
if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){
|
|
247
|
-
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath
|
|
262
|
+
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath);
|
|
248
263
|
}
|
|
249
264
|
this.addChild(currentNode, childNode, jPath, i);
|
|
250
265
|
}
|
|
@@ -262,7 +277,7 @@ const parseXml = function(xmlData) {
|
|
|
262
277
|
}
|
|
263
278
|
i = endIndex;
|
|
264
279
|
} else if( xmlData.substr(i + 1, 2) === '!D') {
|
|
265
|
-
const result = readDocType(xmlData, i);
|
|
280
|
+
const result = docTypeReader.readDocType(xmlData, i);
|
|
266
281
|
this.docTypeEntities = result.entities;
|
|
267
282
|
i = result.i;
|
|
268
283
|
}else if(xmlData.substr(i + 1, 2) === '![') {
|
|
@@ -291,7 +306,12 @@ const parseXml = function(xmlData) {
|
|
|
291
306
|
let closeIndex = result.closeIndex;
|
|
292
307
|
|
|
293
308
|
if (this.options.transformTagName) {
|
|
294
|
-
|
|
309
|
+
//console.log(tagExp, tagName)
|
|
310
|
+
const newTagName = this.options.transformTagName(tagName);
|
|
311
|
+
if(tagExp === tagName) {
|
|
312
|
+
tagExp = newTagName
|
|
313
|
+
}
|
|
314
|
+
tagName = newTagName;
|
|
295
315
|
}
|
|
296
316
|
|
|
297
317
|
//save text as child node
|
|
@@ -312,7 +332,7 @@ const parseXml = function(xmlData) {
|
|
|
312
332
|
jPath += jPath ? "." + tagName : tagName;
|
|
313
333
|
}
|
|
314
334
|
const startIndex = i;
|
|
315
|
-
if (this.isItStopNode(this.
|
|
335
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
|
|
316
336
|
let tagContent = "";
|
|
317
337
|
//self-closing tag
|
|
318
338
|
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
|
@@ -342,7 +362,8 @@ const parseXml = function(xmlData) {
|
|
|
342
362
|
const childNode = new xmlNode(tagName);
|
|
343
363
|
|
|
344
364
|
if(tagName !== tagExp && attrExpPresent){
|
|
345
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath
|
|
365
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath
|
|
366
|
+
);
|
|
346
367
|
}
|
|
347
368
|
if(tagContent) {
|
|
348
369
|
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
@@ -364,12 +385,16 @@ const parseXml = function(xmlData) {
|
|
|
364
385
|
}
|
|
365
386
|
|
|
366
387
|
if(this.options.transformTagName) {
|
|
367
|
-
|
|
388
|
+
const newTagName = this.options.transformTagName(tagName);
|
|
389
|
+
if(tagExp === tagName) {
|
|
390
|
+
tagExp = newTagName
|
|
391
|
+
}
|
|
392
|
+
tagName = newTagName;
|
|
368
393
|
}
|
|
369
394
|
|
|
370
395
|
const childNode = new xmlNode(tagName);
|
|
371
396
|
if(tagName !== tagExp && attrExpPresent){
|
|
372
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath
|
|
397
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
373
398
|
}
|
|
374
399
|
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
375
400
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
@@ -380,7 +405,7 @@ const parseXml = function(xmlData) {
|
|
|
380
405
|
this.tagsNodeStack.push(currentNode);
|
|
381
406
|
|
|
382
407
|
if(tagName !== tagExp && attrExpPresent){
|
|
383
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath
|
|
408
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
384
409
|
}
|
|
385
410
|
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
386
411
|
currentNode = childNode;
|
|
@@ -401,6 +426,7 @@ function addChild(currentNode, childNode, jPath, startIndex){
|
|
|
401
426
|
if (!this.options.captureMetaData) startIndex = undefined;
|
|
402
427
|
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"])
|
|
403
428
|
if(result === false){
|
|
429
|
+
//do nothing
|
|
404
430
|
} else if(typeof result === "string"){
|
|
405
431
|
childNode.tagname = result
|
|
406
432
|
currentNode.addChild(childNode, startIndex);
|
|
@@ -450,17 +476,14 @@ function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
|
450
476
|
|
|
451
477
|
//TODO: use jPath to simplify the logic
|
|
452
478
|
/**
|
|
453
|
-
*
|
|
454
|
-
* @param {
|
|
479
|
+
* @param {Set} stopNodesExact
|
|
480
|
+
* @param {Set} stopNodesWildcard
|
|
455
481
|
* @param {string} jPath
|
|
456
|
-
* @param {string} currentTagName
|
|
482
|
+
* @param {string} currentTagName
|
|
457
483
|
*/
|
|
458
|
-
function isItStopNode(
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
const stopNodeExp = stopNodes[stopNodePath];
|
|
462
|
-
if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true;
|
|
463
|
-
}
|
|
484
|
+
function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName){
|
|
485
|
+
if(stopNodesWildcard && stopNodesWildcard.has(currentTagName)) return true;
|
|
486
|
+
if(stopNodesExact && stopNodesExact.has(jPath)) return true;
|
|
464
487
|
return false;
|
|
465
488
|
}
|
|
466
489
|
|
|
@@ -604,3 +627,13 @@ function parseValue(val, shouldParse, options) {
|
|
|
604
627
|
}
|
|
605
628
|
}
|
|
606
629
|
}
|
|
630
|
+
|
|
631
|
+
function fromCodePoint(str, base, prefix){
|
|
632
|
+
const codePoint = Number.parseInt(str, base);
|
|
633
|
+
|
|
634
|
+
if (codePoint >= 0 && codePoint <= 0x10FFFF) {
|
|
635
|
+
return String.fromCodePoint(codePoint);
|
|
636
|
+
} else {
|
|
637
|
+
return prefix +str + ";";
|
|
638
|
+
}
|
|
639
|
+
}
|
|
@@ -13,16 +13,16 @@ export default class XMLParser{
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Parse XML dats to JS object
|
|
16
|
-
* @param {string|
|
|
16
|
+
* @param {string|Uint8Array} xmlData
|
|
17
17
|
* @param {boolean|Object} validationOption
|
|
18
18
|
*/
|
|
19
19
|
parse(xmlData,validationOption){
|
|
20
|
-
if(typeof xmlData
|
|
21
|
-
}else if( xmlData.toString){
|
|
20
|
+
if(typeof xmlData !== "string" && xmlData.toString){
|
|
22
21
|
xmlData = xmlData.toString();
|
|
23
|
-
}else{
|
|
22
|
+
}else if(typeof xmlData !== "string"){
|
|
24
23
|
throw new Error("XML data is accepted in String or Bytes[] form.")
|
|
25
24
|
}
|
|
25
|
+
|
|
26
26
|
if( validationOption){
|
|
27
27
|
if(validationOption === true) validationOption = {}; //validate with default options
|
|
28
28
|
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"organization": false
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@cdk8s/projen-common": "0.0.
|
|
45
|
+
"@cdk8s/projen-common": "0.0.664",
|
|
46
46
|
"@stylistic/eslint-plugin": "^2",
|
|
47
47
|
"@types/fs-extra": "^11.0.4",
|
|
48
48
|
"@types/jest": "^27",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"aws-cdk": "^2.1104.0",
|
|
53
53
|
"aws-cdk-lib": "2.195.0",
|
|
54
54
|
"cdk8s": "2.68.91",
|
|
55
|
-
"cdk8s-cli": "^2.204.
|
|
55
|
+
"cdk8s-cli": "^2.204.4",
|
|
56
56
|
"commit-and-tag-version": "^12",
|
|
57
57
|
"constructs": "10.3.0",
|
|
58
58
|
"eslint": "^9",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"constructs": "^10.3.0"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@aws-sdk/client-cloudformation": "^3.
|
|
80
|
+
"@aws-sdk/client-cloudformation": "^3.981.0"
|
|
81
81
|
},
|
|
82
82
|
"bundledDependencies": [
|
|
83
83
|
"@aws-sdk/client-cloudformation"
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
|
-
"version": "0.0.
|
|
96
|
+
"version": "0.0.472",
|
|
97
97
|
"jest": {
|
|
98
98
|
"coverageProvider": "v8",
|
|
99
99
|
"testMatch": [
|