xml-toolkit 1.0.33 → 1.0.34
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/lib/EntityResolver.js +10 -4
- package/package.json +20 -3
package/lib/EntityResolver.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const XMLReader = require ('./XMLReader.js')
|
|
2
2
|
|
|
3
3
|
const CH_HASH = '#'.charCodeAt (0)
|
|
4
|
+
const CH_X = 'x'.charCodeAt (0)
|
|
4
5
|
|
|
5
6
|
const PREDEFINED = new Map ([
|
|
6
7
|
['lt' , '<'],
|
|
@@ -37,18 +38,23 @@ const EntityResolver = class {
|
|
|
37
38
|
r += body.get (key)
|
|
38
39
|
|
|
39
40
|
}
|
|
40
|
-
else {
|
|
41
|
+
else if (key.charCodeAt (0) === CH_HASH) {
|
|
41
42
|
|
|
42
|
-
const charCode = key.charCodeAt (
|
|
43
|
-
|
|
44
|
-
if (isNaN (charCode) || charCode <= 0) throw new Error ('Unknown entity reference ' + key + ' in ' + JSON.stringify ([s]))
|
|
43
|
+
const charCode = key.charCodeAt (1) === CH_X ? parseInt (key.slice (2), 16) : parseInt (key.slice (1), 10)
|
|
45
44
|
|
|
45
|
+
if (isNaN (charCode) || charCode <= 0) throw Error ('Invalid character reference ' + key + ' in ' + JSON.stringify ([s]))
|
|
46
|
+
|
|
46
47
|
const c = String.fromCharCode (charCode)
|
|
47
48
|
|
|
48
49
|
body.set (key, c)
|
|
49
50
|
|
|
50
51
|
r += c
|
|
51
52
|
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
|
|
56
|
+
throw Error ('Unknown entity reference ' + key + ' in ' + JSON.stringify ([s]))
|
|
57
|
+
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
start = s.indexOf ('&', ++ end)
|
package/package.json
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xml-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "XML parser, marshaller, SOAP adapter",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"files": ["/lib"],
|
|
6
|
+
"files": ["/lib", "/badges"],
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "
|
|
8
|
+
"test": "jest",
|
|
9
|
+
"test-ci": "jest --ci --coverage"
|
|
10
|
+
},
|
|
11
|
+
"jest": {
|
|
12
|
+
"collectCoverageFrom": [
|
|
13
|
+
"lib/**/*.js"
|
|
14
|
+
],
|
|
15
|
+
"coverageReporters": ["clover", "json", "lcov", "text", "json-summary"],
|
|
16
|
+
"verbose": false,
|
|
17
|
+
"testPathIgnorePatterns": [
|
|
18
|
+
"/node_modules/",
|
|
19
|
+
"/__tests__/0ld",
|
|
20
|
+
"/__tests__/data",
|
|
21
|
+
"/__tests__/lib"
|
|
22
|
+
]
|
|
9
23
|
},
|
|
10
24
|
"repository": {
|
|
11
25
|
"type": "git",
|
|
@@ -24,6 +38,9 @@
|
|
|
24
38
|
"url": "https://github.com/do-/node-xml-toolkit/issues"
|
|
25
39
|
},
|
|
26
40
|
"homepage": "https://github.com/do-/node-xml-toolkit#readme",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"jest": "^29.3.1"
|
|
43
|
+
},
|
|
27
44
|
"dependencies": {
|
|
28
45
|
"string-escape-map": "^1.0.0"
|
|
29
46
|
}
|