Socket
Socket
Sign inDemoInstall

fast-xml-parser

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-xml-parser - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

3

CHANGELOG.md
Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.
**4.2.1 / 2023-04-18**
* fix: jpath after unpaired tags
**4.2.0 / 2023-04-09**

@@ -4,0 +7,0 @@ * support `updateTag` parser property

2

package.json
{
"name": "fast-xml-parser",
"version": "4.2.0",
"version": "4.2.1",
"description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",

@@ -5,0 +5,0 @@ "main": "./src/fxp.js",

@@ -209,4 +209,13 @@ 'use strict';

jPath = jPath.substr(0, jPath.lastIndexOf("."));
//check if last tag of nested tag was unpaired tag
const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1);
let propIndex = 0
if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){
propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1)
if(propIndex < 1) propIndex = jPath.lastIndexOf(".");
}else{
propIndex = jPath.lastIndexOf(".");
}
jPath = jPath.substring(0, propIndex);
currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope

@@ -288,6 +297,2 @@ textData = "";

if(tagName !== xmlObj.tagname){
jPath += jPath ? "." + tagName : tagName;
}
//check if last tag was unpaired tag

@@ -297,4 +302,7 @@ const lastTag = currentNode;

currentNode = this.tagsNodeStack.pop();
jPath = jPath.substring(0, jPath.lastIndexOf("."));
}
if(tagName !== xmlObj.tagname){
jPath += jPath ? "." + tagName : tagName;
}
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace

@@ -306,3 +314,3 @@ let tagContent = "";

}
//boolean tag
//unpaired tag
else if(this.options.unpairedTags.indexOf(tagName) !== -1){

@@ -350,4 +358,4 @@ i = result.closeIndex;

}
this.addChild(currentNode, childNode, jPath)
jPath = jPath.substr(0, jPath.lastIndexOf("."));
this.addChild(currentNode, childNode, jPath)
}

@@ -354,0 +362,0 @@ //opening tag

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc