fast-xml-parser 4.3.3 → 4.3.4

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,8 @@
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.3.4 / 2024-01-10**
4
+ * fix: Don't escape entities in CDATA sections (#633) (By [wackbyte](https://github.com/wackbyte))
5
+
3
6
  **4.3.3 / 2024-01-10**
4
7
  * Remove unnecessary regex
5
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-xml-parser",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
4
4
  "description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
5
5
  "main": "./src/fxp.js",
6
6
  "scripts": {
package/src/fxp.d.ts CHANGED
@@ -387,10 +387,10 @@ export class XMLParser {
387
387
  parse(xmlData: string | Buffer ,validationOptions?: validationOptions | boolean): any;
388
388
  /**
389
389
  * Add Entity which is not by default supported by this library
390
- * @param entityIndentifier {string} Eg: 'ent' for &ent;
390
+ * @param entityIdentifier {string} Eg: 'ent' for &ent;
391
391
  * @param entityValue {string} Eg: '\r'
392
392
  */
393
- addEntity(entityIndentifier: string, entityValue: string): void;
393
+ addEntity(entityIdentifier: string, entityValue: string): void;
394
394
  }
395
395
 
396
396
  export class XMLValidator{
@@ -265,14 +265,13 @@ const parseXml = function(xmlData) {
265
265
 
266
266
  textData = this.saveTextToParentTag(textData, currentNode, jPath);
267
267
 
268
+ let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
269
+ if(val == undefined) val = "";
270
+
268
271
  //cdata should be set even if it is 0 length string
269
272
  if(this.options.cdataPropName){
270
- // let val = this.parseTextData(tagExp, this.options.cdataPropName, jPath + "." + this.options.cdataPropName, true, false, true);
271
- // if(!val) val = "";
272
273
  currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]);
273
274
  }else{
274
- let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true);
275
- if(val == undefined) val = "";
276
275
  currentNode.add(this.options.textNodeName, val);
277
276
  }
278
277