@depup/fast-xml-parser 5.5.11-depup.0 → 5.10.1-depup.0

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.
@@ -31,8 +31,8 @@ export default class XMLParser {
31
31
  throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`)
32
32
  }
33
33
  }
34
- const orderedObjParser = new OrderedObjParser(this.options);
35
- orderedObjParser.addExternalEntities(this.externalEntities);
34
+ const orderedObjParser = new OrderedObjParser(this.options, this.externalEntities);
35
+ // orderedObjParser.entityDecoder.setExternalEntities(this.externalEntities);
36
36
  const orderedResult = orderedObjParser.parseXml(xmlData);
37
37
  if (this.options.preserveOrder || orderedResult === undefined) return orderedResult;
38
38
  else return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
@@ -71,6 +71,10 @@ function compress(arr, options, matcher, readonlyMatcher) {
71
71
  let val = compress(tagObj[property], options, matcher, readonlyMatcher);
72
72
  const isLeaf = isLeafTag(val, options);
73
73
 
74
+ if (Object.keys(val).length === 0 && options.alwaysCreateTextNode) {
75
+ val[options.textNodeName] = "";
76
+ }
77
+
74
78
  if (tagObj[":@"]) {
75
79
  assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
76
80
  } else if (Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode) {