fast-xml-parser 4.2.4 → 4.2.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.
2
2
 
3
+ **4.2.6 / 2023-07-17**
4
+ * Remove trailing slash from jPath for self-closing tags (#595) (By [Maciej Radzikowski](https://github.com/m-radzikowski))
5
+
6
+ **4.2.5 / 2023-06-22**
7
+ * change code implementation
8
+
3
9
  **4.2.4 / 2023-06-06**
4
10
  * fix security bug
5
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-xml-parser",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
5
5
  "main": "./src/fxp.js",
6
6
  "scripts": {
@@ -39,7 +39,7 @@
39
39
  "json2xml",
40
40
  "html"
41
41
  ],
42
- "author": "Amit Gupta (https://amitkumargupta.work/)",
42
+ "author": "Amit Gupta (https://amitguptagwl.github.io)",
43
43
  "license": "MIT",
44
44
  "devDependencies": {
45
45
  "@babel/core": "^7.13.10",
@@ -1,3 +1,5 @@
1
+ const util = require('../util');
2
+
1
3
  //TODO: handle comments
2
4
  function readDocType(xmlData, i){
3
5
 
@@ -140,16 +142,11 @@ function isNotation(xmlData, i){
140
142
  return false
141
143
  }
142
144
 
143
- //an entity name should not contains special characters that may be used in regex
144
- //Eg !?\\\/[]$%{}^&*()<>
145
- const specialChar = "!?\\\/[]$%{}^&*()<>|+";
146
-
147
145
  function validateEntityName(name){
148
- for (let i = 0; i < specialChar.length; i++) {
149
- const ch = specialChar[i];
150
- if(name.indexOf(ch) !== -1) throw new Error(`Invalid character ${ch} in entity name`);
151
- }
152
- return name;
146
+ if (util.isName(name))
147
+ return name;
148
+ else
149
+ throw new Error(`Invalid entity name ${name}`);
153
150
  }
154
151
 
155
- module.exports = readDocType;
152
+ module.exports = readDocType;
@@ -341,6 +341,7 @@ const parseXml = function(xmlData) {
341
341
  if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
342
342
  if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
343
343
  tagName = tagName.substr(0, tagName.length - 1);
344
+ jPath = jPath.substr(0, jPath.length - 1);
344
345
  tagExp = tagName;
345
346
  }else{
346
347
  tagExp = tagExp.substr(0, tagExp.length - 1);