fast-xml-parser 5.4.0 → 5.4.1
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 +5 -1
- package/lib/fxp.cjs +1 -1
- package/lib/fxp.min.js +1 -1
- package/lib/fxp.min.js.map +1 -1
- package/lib/fxparser.min.js +1 -1
- package/lib/fxparser.min.js.map +1 -1
- package/package.json +1 -1
- package/src/xmlparser/OrderedObjParser.js +16 -5
|
@@ -414,6 +414,17 @@ const parseXml = function (xmlData) {
|
|
|
414
414
|
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
415
415
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
416
416
|
}
|
|
417
|
+
else if(this.options.unpairedTags.indexOf(tagName) !== -1){//unpaired tag
|
|
418
|
+
const childNode = new xmlNode(tagName);
|
|
419
|
+
if(tagName !== tagExp && attrExpPresent){
|
|
420
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
421
|
+
}
|
|
422
|
+
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
423
|
+
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
424
|
+
i = result.closeIndex;
|
|
425
|
+
// Continue to next iteration without changing currentNode
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
417
428
|
//opening tag
|
|
418
429
|
else {
|
|
419
430
|
const childNode = new xmlNode(tagName);
|
|
@@ -535,19 +546,19 @@ const replaceEntitiesValue = function (val, tagName, jPath) {
|
|
|
535
546
|
}
|
|
536
547
|
|
|
537
548
|
|
|
538
|
-
function saveTextToParentTag(textData,
|
|
549
|
+
function saveTextToParentTag(textData, parentNode, jPath, isLeafNode) {
|
|
539
550
|
if (textData) { //store previously collected data as textNode
|
|
540
|
-
if (isLeafNode === undefined) isLeafNode =
|
|
551
|
+
if (isLeafNode === undefined) isLeafNode = parentNode.child.length === 0
|
|
541
552
|
|
|
542
553
|
textData = this.parseTextData(textData,
|
|
543
|
-
|
|
554
|
+
parentNode.tagname,
|
|
544
555
|
jPath,
|
|
545
556
|
false,
|
|
546
|
-
|
|
557
|
+
parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false,
|
|
547
558
|
isLeafNode);
|
|
548
559
|
|
|
549
560
|
if (textData !== undefined && textData !== "")
|
|
550
|
-
|
|
561
|
+
parentNode.add(this.options.textNodeName, textData);
|
|
551
562
|
textData = "";
|
|
552
563
|
}
|
|
553
564
|
return textData;
|