@magic-xpa/utils 4.1300.0-dev4130.20 → 4.1300.0-dev4130.201

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.
@@ -1,5 +1,5 @@
1
1
  import { Encoding, StringBuilder, Hashtable, Stack, NChar, NNumber, NString, RefParam, isNullOrUndefined, DateTime, ISO_8859_1_Encoding, ApplicationException, Int32, Exception, List, Thread, Debug } from '@magic-xpa/mscorelib';
2
- import { parseString } from 'xml2js';
2
+ import { XMLParser } from 'fast-xml-parser';
3
3
 
4
4
  /// <summary>JPN: DBCS support
5
5
  /// Utility Class for String
@@ -4978,7 +4978,8 @@ class InternalInterface {
4978
4978
  static MG_ACT_CONTEXT_TIMEOUT_RESET = 636;
4979
4979
  static MG_ACT_CONTEXT_REMOVE = 647;
4980
4980
  static MG_ACT_DUMP_ENVIRONMENT = 653;
4981
- static MG_ACT_TOT_CNT = 654;
4981
+ static MG_ACT_PUBSUB_TOPIC_PUBLISHED = 659;
4982
+ static MG_ACT_TOT_CNT = 660;
4982
4983
  // NEW INTERNAL EVENTS
4983
4984
  static MG_ACT_TASK_PREFIX = 1001;
4984
4985
  static MG_ACT_TASK_SUFFIX = 1002;
@@ -5020,9 +5021,30 @@ class InternalInterface {
5020
5021
  }
5021
5022
  }
5022
5023
 
5024
+ const parser = new XMLParser({
5025
+ ignoreAttributes: false,
5026
+ attributeNamePrefix: "",
5027
+ attributesGroupName: "$",
5028
+ textNodeName: "_",
5029
+ parseTagValue: false,
5030
+ parseAttributeValue: false,
5031
+ trimValues: false,
5032
+ isArray: (_name, jPath, _isLeafNode, isAttribute) => {
5033
+ if (isAttribute) {
5034
+ return false;
5035
+ }
5036
+ // Keep root object shape as xml2js default; force arrays for child elements.
5037
+ return jPath.indexOf(".") !== -1;
5038
+ }
5039
+ });
5023
5040
  class JSON_Utils {
5024
5041
  static JSONFromXML(xml, onComplete) {
5025
- parseString(xml, onComplete);
5042
+ try {
5043
+ onComplete(null, parser.parse(xml));
5044
+ }
5045
+ catch (error) {
5046
+ onComplete(error, null);
5047
+ }
5026
5048
  }
5027
5049
  }
5028
5050