itoolkit 1.0.2 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +1 -2
  2. package/lib/Deprecated.js +890 -873
  3. package/package.json +15 -10
package/lib/Deprecated.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /* eslint-disable default-param-last */
6
6
 
7
7
  const deprecate = require('depd');
8
- const { parseString } = require('xml2js');
8
+ const { XMLParser, XMLValidator } = require('fast-xml-parser');
9
9
 
10
10
  const iPgmDeprecate = deprecate('iPgm');
11
11
  const iSqlDeprecate = deprecate('iSql');
@@ -676,26 +676,27 @@ class iDataQueue {
676
676
  cb(null);
677
677
  return;
678
678
  }
679
- parseString(str, (parseError, result) => {
680
- if (parseError) {
681
- if (this.reportError) {
682
- cb(parseError, null);
683
- return;
684
- }
685
- cb(str);
686
- return;
687
- }
688
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
689
- rtValue = true;
690
- } else {
691
- rtValue = str;
692
- }
679
+ const parser = new XMLParser();
680
+ const result = parser.parse(str);
681
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
693
682
  if (this.reportError) {
694
- cb(null, rtValue); // Run the call back function against the returned value.
683
+ cb(Error('Unable to parse the xml input'), null);
695
684
  return;
696
685
  }
697
- cb(rtValue);
698
- });
686
+ cb(str);
687
+ return;
688
+ }
689
+
690
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
691
+ rtValue = true;
692
+ } else {
693
+ rtValue = str;
694
+ }
695
+ if (this.reportError) {
696
+ cb(null, rtValue);
697
+ return;
698
+ }
699
+ cb(rtValue);
699
700
  };
700
701
 
701
702
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -738,27 +739,26 @@ class iDataQueue {
738
739
  cb(null);
739
740
  return;
740
741
  }
741
- parseString(str, (parseError, result) => {
742
- if (parseError) {
743
- if (this.reportError) {
744
- cb(parseError, null);
745
- return;
746
- }
747
- cb(str);
748
- return;
749
- }
750
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
751
- rtValue = result.myscript.pgm[0].parm[3].data[0]._;
752
- } else {
753
- rtValue = str;
754
- }
755
-
742
+ const parser = new XMLParser();
743
+ const result = parser.parse(str);
744
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
756
745
  if (this.reportError) {
757
- cb(null, rtValue);
746
+ cb(Error('Unable to parse the xml input'), null);
758
747
  return;
759
748
  }
760
- cb(rtValue);
761
- });
749
+ cb(str);
750
+ return;
751
+ }
752
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
753
+ rtValue = result.myscript.pgm.parm[3].data;
754
+ } else {
755
+ rtValue = str;
756
+ }
757
+ if (this.reportError) {
758
+ cb(null, rtValue);
759
+ return;
760
+ }
761
+ cb(rtValue);
762
762
  };
763
763
  this.conn.run(toJson); // Post the input XML and get the response.
764
764
  }
@@ -795,26 +795,26 @@ class iDataQueue {
795
795
  cb(null);
796
796
  return;
797
797
  }
798
- parseString(str, (parseError, result) => {
799
- if (parseError) {
800
- if (this.reportError) {
801
- cb(parseError, null);
802
- return;
803
- }
804
- cb(str);
805
- return;
806
- }
807
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
808
- rtValue = true;
809
- } else {
810
- rtValue = str;
811
- }
798
+ const parser = new XMLParser();
799
+ const result = parser.parse(str);
800
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
812
801
  if (this.reportError) {
813
- cb(null, rtValue);
802
+ cb(Error('Unable to parse the xml input'), null);
814
803
  return;
815
804
  }
816
- cb(rtValue);
817
- });
805
+ cb(str);
806
+ return;
807
+ }
808
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
809
+ rtValue = true;
810
+ } else {
811
+ rtValue = str;
812
+ }
813
+ if (this.reportError) {
814
+ cb(null, rtValue);
815
+ return;
816
+ }
817
+ cb(rtValue);
818
818
  };
819
819
 
820
820
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -978,56 +978,57 @@ class iNetwork {
978
978
  cb(null);
979
979
  return;
980
980
  }
981
- parseString(str, (parseError, result) => {
982
- if (parseError) {
983
- if (this.reportError) {
984
- cb(parseError, null);
985
- return;
986
- }
987
- cb(str);
988
- return;
989
- }
990
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
991
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
992
- rtValue = {
993
- 'TCP/IPv4_stack_status': data[2]._,
994
- How_long_active: data[3]._,
995
- 'When_last_started_-_date': data[4]._,
996
- 'When_last_started_-_time': data[5]._,
997
- 'When_last_ended_-_date': data[6]._,
998
- 'When_last_ended_-_time': data[7]._,
999
- 'Who_last_started_-_job_name': data[8]._,
1000
- 'Who_last_started_-_job_user_name': data[9]._,
1001
- 'Who_last_started_-_job_number': data[10]._,
1002
- 'Who_last_started_-_internal_job_identifier': data[11]._,
1003
- 'Who_last_ended_-_job_name': data[12]._,
1004
- 'Who_last_ended_-_job_user_name': data[13]._,
1005
- 'Who_last_ended_-_job_number': data[14]._,
1006
- 'Who_last_ended_-_internal_job_identifier': data[14]._,
1007
- Offset_to_additional_information: data[16]._,
1008
- Length_of_additional_information: data[17]._,
1009
- Limited_mode: data[18]._,
1010
- Offset_to_list_of_Internet_addresses: data[19]._,
1011
- Number_of_Internet_addresses: data[20]._,
1012
- Entry_length_for_list_of_Internet_addresses: data[21]._,
1013
- DNS_protocol: data[22]._,
1014
- Retries: data[23]._,
1015
- Time_interval: data[24]._,
1016
- Search_order: data[25]._,
1017
- Initial_domain_name_server: data[26]._,
1018
- DNS_listening_port: data[27]._,
1019
- Host_name: data[28]._,
1020
- Domain_name: data[29]._,
1021
- Domain_search_list: data[31]._,
1022
- };
1023
- } else { rtValue = str; }
1024
-
981
+ const parser = new XMLParser();
982
+ const result = parser.parse(str);
983
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1025
984
  if (this.reportError) {
1026
- cb(null, rtValue);
985
+ cb(Error('Unable to parse the xml input'), null);
1027
986
  return;
1028
987
  }
1029
- cb(rtValue);
1030
- });
988
+ cb(str);
989
+ return;
990
+ }
991
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
992
+ const data = result.myscript.pgm.parm[0].ds;
993
+ rtValue = {
994
+ 'TCP/IPv4_stack_status': data[2],
995
+ How_long_active: data[2],
996
+ 'When_last_started_-_date': data[4],
997
+ 'When_last_started_-_time': data[5],
998
+ 'When_last_ended_-_date': data[6],
999
+ 'When_last_ended_-_time': data[7],
1000
+ 'Who_last_started_-_job_name': data[8],
1001
+ 'Who_last_started_-_job_user_name': data[9],
1002
+ 'Who_last_started_-_job_number': data[10],
1003
+ 'Who_last_started_-_internal_job_identifier': data[11],
1004
+ 'Who_last_ended_-_job_name': data[12],
1005
+ 'Who_last_ended_-_job_user_name': data[13],
1006
+ 'Who_last_ended_-_job_number': data[14],
1007
+ 'Who_last_ended_-_internal_job_identifier': data[14],
1008
+ Offset_to_additional_information: data[16],
1009
+ Length_of_additional_information: data[17],
1010
+ Limited_mode: data[18],
1011
+ Offset_to_list_of_Internet_addresses: data[19],
1012
+ Number_of_Internet_addresses: data[20],
1013
+ Entry_length_for_list_of_Internet_addresses: data[21],
1014
+ DNS_protocol: data[22],
1015
+ Retries: data[23],
1016
+ Time_interval: data[24],
1017
+ Search_order: data[25],
1018
+ Initial_domain_name_server: data[26],
1019
+ DNS_listening_port: data[27],
1020
+ Host_name: data[28],
1021
+ Domain_name: data[29],
1022
+ Domain_search_list: data[31],
1023
+ };
1024
+ } else {
1025
+ rtValue = str;
1026
+ }
1027
+ if (this.reportError) {
1028
+ cb(null, rtValue);
1029
+ return;
1030
+ }
1031
+ cb(rtValue);
1031
1032
  };
1032
1033
  this.conn.run(toJson); // Post the input XML and get the response.
1033
1034
  }
@@ -1208,74 +1209,75 @@ class iNetwork {
1208
1209
  cb(null);
1209
1210
  return;
1210
1211
  }
1211
- parseString(str, (parseError, result) => {
1212
- if (parseError) {
1213
- if (this.reportError) {
1214
- cb(parseError, null);
1215
- return;
1216
- }
1217
- cb(str);
1218
- return;
1219
- }
1220
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1221
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1222
-
1223
- rtValue = {
1224
- Internet_address: data[2]._,
1225
- Internet_address_binary: data[4]._,
1226
- Network_address: data[5]._,
1227
- Network_address_binary: data[7]._,
1228
- Line_description: data[8]._,
1229
- Interface_status: data[10]._,
1230
- Interface_type_of_service: data[11]._,
1231
- Interface_MTU: data[12]._,
1232
- Interface_line_type: data[13]._,
1233
- Host_address: data[14]._,
1234
- Host_address_binary: data[16]._,
1235
- Interface_subnet_mask: data[17]._,
1236
- Interface_subnet_mask_binary: data[19]._,
1237
- Directed_broadcast_address: data[20]._,
1238
- Directed_broadcast_address_binary: data[22]._,
1239
- Change_date: data[23]._,
1240
- Change_time: data[24]._,
1241
- Associated_local_interface: data[25]._,
1242
- Associated_local_interface_binary: data[27]._,
1243
- Change_status: data[28]._,
1244
- Packet_rules: data[29]._,
1245
- Automatic_start: data[30]._,
1246
- TRLAN_bit_sequencing: data[31]._,
1247
- Interface_type: data[32]._,
1248
- Proxy_ARP_allowed: data[33]._,
1249
- Proxy_ARP_enabled: data[34]._,
1250
- Configured_MTU: data[35]._,
1251
- Network_name: data[36]._,
1252
- Interface_name: data[37]._,
1253
- Alias_name: data[38]._,
1254
- Interface_description: data[40]._,
1255
- Offset_to_preferred_interface_list: data[42]._,
1256
- Number_of_entries_in_preferred_interface_list: data[43]._,
1257
- Length_of_one_preferred_interface_list_entry: data[44]._,
1258
- DHCP_created: data[45]._,
1259
- DHCP_dynamic_DNS_updates: data[46]._,
1260
- DHCP_lease_expiration: data[47]._,
1261
- 'DHCP_lease_expiration_-_date': data[48]._,
1262
- 'DHCP_lease_expiration_-_time': data[49]._,
1263
- DHCP_lease_obtained: data[50]._,
1264
- 'DHCP_lease_obtained_-_date': data[51]._,
1265
- 'DHCP_lease_obtained_-_time': data[52]._,
1266
- Use_DHCP_unique_identifier: data[53]._,
1267
- DHCP_server_IP_address: data[54]._,
1268
- Preferred_interface_Internet_address: data[56]._,
1269
- Preferred_interface_Internet_address_binary: data[58]._,
1270
- };
1271
- } else { rtValue = str; }
1272
-
1212
+ const parser = new XMLParser();
1213
+ const result = parser.parse(str);
1214
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1273
1215
  if (this.reportError) {
1274
- cb(null, rtValue);
1216
+ cb(Error('Unable to parse the xml input'), null);
1275
1217
  return;
1276
1218
  }
1277
- cb(rtValue);
1278
- });
1219
+ cb(str);
1220
+ return;
1221
+ }
1222
+
1223
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
1224
+ const { data } = result.myscript.pgm.parm[0].ds;
1225
+ rtValue = {
1226
+ Internet_address: data[2],
1227
+ Internet_address_binary: data[4],
1228
+ Network_address: data[5],
1229
+ Network_address_binary: data[7],
1230
+ Line_description: data[8],
1231
+ Interface_status: data[10],
1232
+ Interface_type_of_service: data[11],
1233
+ Interface_MTU: data[12],
1234
+ Interface_line_type: data[13],
1235
+ Host_address: data[14],
1236
+ Host_address_binary: data[16],
1237
+ Interface_subnet_mask: data[17],
1238
+ Interface_subnet_mask_binary: data[19],
1239
+ Directed_broadcast_address: data[20],
1240
+ Directed_broadcast_address_binary: data[22],
1241
+ Change_date: data[23],
1242
+ Change_time: data[24],
1243
+ Associated_local_interface: data[25],
1244
+ Associated_local_interface_binary: data[27],
1245
+ Change_status: data[28],
1246
+ Packet_rules: data[29],
1247
+ Automatic_start: data[30],
1248
+ TRLAN_bit_sequencing: data[31],
1249
+ Interface_type: data[32],
1250
+ Proxy_ARP_allowed: data[33],
1251
+ Proxy_ARP_enabled: data[34],
1252
+ Configured_MTU: data[35],
1253
+ Network_name: data[36],
1254
+ Interface_name: data[37],
1255
+ Alias_name: data[38],
1256
+ Interface_description: data[40],
1257
+ Offset_to_preferred_interface_list: data[42],
1258
+ Number_of_entries_in_preferred_interface_list: data[43],
1259
+ Length_of_one_preferred_interface_list_entry: data[44],
1260
+ DHCP_created: data[45],
1261
+ DHCP_dynamic_DNS_updates: data[46],
1262
+ DHCP_lease_expiration: data[47],
1263
+ 'DHCP_lease_expiration_-_date': data[48],
1264
+ 'DHCP_lease_expiration_-_time': data[49],
1265
+ DHCP_lease_obtained: data[50],
1266
+ 'DHCP_lease_obtained_-_date': data[51],
1267
+ 'DHCP_lease_obtained_-_time': data[52],
1268
+ Use_DHCP_unique_identifier: data[53],
1269
+ DHCP_server_IP_address: data[54],
1270
+ Preferred_interface_Internet_address: data[56],
1271
+ Preferred_interface_Internet_address_binary: data[58],
1272
+ };
1273
+ } else {
1274
+ rtValue = str;
1275
+ }
1276
+ if (this.reportError) {
1277
+ cb(null, rtValue);
1278
+ return;
1279
+ }
1280
+ cb(rtValue);
1279
1281
  };
1280
1282
  this.conn.run(toJson); // Post the input XML and get the response.
1281
1283
  }
@@ -1367,26 +1369,27 @@ class iObj {
1367
1369
  cb(null);
1368
1370
  return;
1369
1371
  }
1370
- parseString(str, (parseError, result) => {
1371
- if (parseError) {
1372
- if (this.reportError) {
1373
- cb(parseError, null);
1374
- return;
1375
- }
1376
- cb(str);
1377
- return;
1378
- }
1379
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1380
- rtValue = true;
1381
- } else {
1382
- rtValue = str;
1383
- }
1372
+ const parser = new XMLParser();
1373
+ const result = parser.parse(str);
1374
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1384
1375
  if (this.reportError) {
1385
- cb(null, rtValue);
1376
+ cb(Error('Unable to parse the xml input'), null);
1386
1377
  return;
1387
1378
  }
1388
- cb(rtValue);
1389
- });
1379
+ cb(str);
1380
+ return;
1381
+ }
1382
+
1383
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
1384
+ rtValue = true;
1385
+ } else {
1386
+ rtValue = str;
1387
+ }
1388
+ if (this.reportError) {
1389
+ cb(null, rtValue);
1390
+ return;
1391
+ }
1392
+ cb(rtValue);
1390
1393
  };
1391
1394
 
1392
1395
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -1520,59 +1523,61 @@ class iObj {
1520
1523
  cb(null);
1521
1524
  return;
1522
1525
  }
1523
- parseString(str, (parseError, result) => {
1524
- if (parseError) {
1525
- if (this.reportError) {
1526
- cb(parseError, null);
1527
- return;
1528
- }
1529
- cb(str);
1530
- return;
1531
- }
1532
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1533
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1534
-
1535
- rtValue = {
1536
- 'Object_authority_/_Data_authority': data[2]._,
1537
- Authorization_list_management: data[3]._,
1538
- Object_operational: data[4]._,
1539
- Object_management: data[5]._,
1540
- Object_existence: data[6]._,
1541
- Data_read: data[7]._,
1542
- Data_add: data[8]._,
1543
- Data_update: data[9]._,
1544
- Data_delete: data[10]._,
1545
- Authorization_list: data[11]._,
1546
- Authority_source: data[12]._,
1547
- Some_adopted_authority: data[13]._,
1548
- Adopted_object_authority: data[14]._,
1549
- Adopted_authorization_list_management: data[15]._,
1550
- Adopted_object_operational: data[16]._,
1551
- Adopted_object_management: data[17]._,
1552
- Adopted_object_existence: data[18]._,
1553
- Adopted_data_read: data[19]._,
1554
- Adopted_data_add: data[20]._,
1555
- Adopted_data_update: data[21]._,
1556
- Adopted_data_delete: data[22]._,
1557
- Adopted_data_execute: data[23]._,
1558
- Adopted_object_alter: data[25]._,
1559
- Adopted_object_reference: data[26]._,
1560
- Data_execute: data[28]._,
1561
- Object_alter: data[30]._,
1562
- Object_reference: data[31]._,
1563
- ASP_device_name_of_library: data[32]._,
1564
- ASP_device_name_of_object: data[33]._,
1565
- Offset_to_group_information_table: data[35]._,
1566
- Number_of_group_table_entries_returned: data[36]._,
1567
- };
1568
- } else { rtValue = str; }
1569
-
1526
+ const parser = new XMLParser();
1527
+ const result = parser.parse(str);
1528
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1570
1529
  if (this.reportError) {
1571
- cb(null, rtValue);
1530
+ cb(Error('Unable to parse the xml input'), null);
1572
1531
  return;
1573
1532
  }
1574
- cb(rtValue);
1575
- });
1533
+ cb(str);
1534
+ return;
1535
+ }
1536
+
1537
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
1538
+ const { data } = result.myscript.pgm.parm[0].ds;
1539
+
1540
+ rtValue = {
1541
+ 'Object_authority_/_Data_authority': data[2],
1542
+ Authorization_list_management: data[3],
1543
+ Object_operational: data[4],
1544
+ Object_management: data[5],
1545
+ Object_existence: data[6],
1546
+ Data_read: data[7],
1547
+ Data_add: data[8],
1548
+ Data_update: data[9],
1549
+ Data_delete: data[10],
1550
+ Authorization_list: data[11],
1551
+ Authority_source: data[12],
1552
+ Some_adopted_authority: data[13],
1553
+ Adopted_object_authority: data[14],
1554
+ Adopted_authorization_list_management: data[15],
1555
+ Adopted_object_operational: data[16],
1556
+ Adopted_object_management: data[17],
1557
+ Adopted_object_existence: data[18],
1558
+ Adopted_data_read: data[19],
1559
+ Adopted_data_add: data[20],
1560
+ Adopted_data_update: data[21],
1561
+ Adopted_data_delete: data[22],
1562
+ Adopted_data_execute: data[23],
1563
+ Adopted_object_alter: data[25],
1564
+ Adopted_object_reference: data[26],
1565
+ Data_execute: data[28],
1566
+ Object_alter: data[30],
1567
+ Object_reference: data[31],
1568
+ ASP_device_name_of_library: data[32],
1569
+ ASP_device_name_of_object: data[33],
1570
+ Offset_to_group_information_table: data[35],
1571
+ Number_of_group_table_entries_returned: data[36],
1572
+ };
1573
+ } else {
1574
+ rtValue = str;
1575
+ }
1576
+ if (this.reportError) {
1577
+ cb(null, rtValue);
1578
+ return;
1579
+ }
1580
+ cb(rtValue);
1576
1581
  };
1577
1582
 
1578
1583
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -1716,69 +1721,68 @@ class iObj {
1716
1721
  return;
1717
1722
  }
1718
1723
 
1719
- parseString(str, (parseError, result) => {
1720
- if (parseError) {
1721
- if (this.reportError) {
1722
- cb(parseError, null);
1723
- return;
1724
- }
1725
- cb(str);
1726
- return;
1727
- }
1728
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1729
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1730
-
1731
- rtValue = {
1732
- Command_name: data[2]._,
1733
- Command_library_name: data[3]._,
1734
- Command_processing_program_or_proxy_target_command: data[4]._,
1735
- "Command_processing_program's_or_proxy_target_command's_library_name": data[5]._,
1736
- Source_file_name: data[6]._,
1737
- Source_file_library_name: data[7]._,
1738
- Source_file_member_name: data[8]._,
1739
- Validity_check_program_name: data[9]._,
1740
- Validity_check_program_library_name: data[10]._,
1741
- Mode_information: data[11]._,
1742
- Where_allowed_to_run: data[12]._,
1743
- Allow_limited_user: data[13]._,
1744
- Maximum_positional_parameters: data[14]._,
1745
- Prompt_message_file_name: data[15]._,
1746
- Prompt_message_file_library_name: data[16]._,
1747
- Message_file_name: data[17]._,
1748
- Message_file_library_name: data[18]._,
1749
- Help_panel_group_name: data[19]._,
1750
- Help_panel_group_library_name: data[20]._,
1751
- Help_identifier: data[21]._,
1752
- Search_index_name: data[22]._,
1753
- Search_index_library_name: data[23]._,
1754
- Current_library: data[24]._,
1755
- Product_library: data[25]._,
1756
- Prompt_override_program_name: data[26]._,
1757
- Prompt_override_program_library_name: data[27]._,
1758
- Restricted_to_target_release: data[28]._,
1759
- Text_description: data[29]._,
1760
- Command_processing_program_call_state: data[30]._,
1761
- Validity_check_program_call_state: data[31]._,
1762
- Prompt_override_program_call_state: data[32]._,
1763
- Offset_to_help_bookshelf_information: data[33]._,
1764
- Length_of_help_bookshelf_information: data[34]._,
1765
- 'Coded_character_set_ID_(CCSID)': data[35]._,
1766
- Enabled_for_GUI_indicator: data[36]._,
1767
- Threadsafe_indicator: data[37]._,
1768
- Multithreaded_job_action: data[38]._,
1769
- Proxy_command_indicator: data[39]._,
1770
- Prompt_message_file_text_indicator: data[40]._,
1771
- };
1772
- } else { rtValue = str; }
1773
-
1724
+ const parser = new XMLParser();
1725
+ const result = parser.parse(str);
1726
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1774
1727
  if (this.reportError) {
1775
- cb(null, rtValue);
1728
+ cb(Error('Unable to parse the xml input'), null);
1776
1729
  return;
1777
1730
  }
1778
- cb(rtValue);
1779
- });
1731
+ cb(str);
1732
+ return;
1733
+ }
1734
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
1735
+ const { data } = result.myscript.pgm.parm[0].ds;
1736
+ rtValue = {
1737
+ Command_name: data[2],
1738
+ Command_library_name: data[3],
1739
+ Command_processing_program_or_proxy_target_command: data[4],
1740
+ "Command_processing_program's_or_proxy_target_command's_library_name": data[5],
1741
+ Source_file_name: data[6],
1742
+ Source_file_library_name: data[7],
1743
+ Source_file_member_name: data[8],
1744
+ Validity_check_program_name: data[9],
1745
+ Validity_check_program_library_name: data[10],
1746
+ Mode_information: data[11],
1747
+ Where_allowed_to_run: data[12],
1748
+ Allow_limited_user: data[13],
1749
+ Maximum_positional_parameters: data[14],
1750
+ Prompt_message_file_name: data[15],
1751
+ Prompt_message_file_library_name: data[16],
1752
+ Message_file_name: data[17],
1753
+ Message_file_library_name: data[18],
1754
+ Help_panel_group_name: data[19],
1755
+ Help_panel_group_library_name: data[20],
1756
+ Help_identifier: data[21],
1757
+ Search_index_name: data[22],
1758
+ Search_index_library_name: data[23],
1759
+ Current_library: data[24],
1760
+ Product_library: data[25],
1761
+ Prompt_override_program_name: data[26],
1762
+ Prompt_override_program_library_name: data[27],
1763
+ Restricted_to_target_release: data[28],
1764
+ Text_description: data[29],
1765
+ Command_processing_program_call_state: data[30],
1766
+ Validity_check_program_call_state: data[31],
1767
+ Prompt_override_program_call_state: data[32],
1768
+ Offset_to_help_bookshelf_information: data[33],
1769
+ Length_of_help_bookshelf_information: data[34],
1770
+ 'Coded_character_set_ID_(CCSID)': data[35],
1771
+ Enabled_for_GUI_indicator: data[36],
1772
+ Threadsafe_indicator: data[37],
1773
+ Multithreaded_job_action: data[38],
1774
+ Proxy_command_indicator: data[39],
1775
+ Prompt_message_file_text_indicator: data[40],
1776
+ };
1777
+ } else {
1778
+ rtValue = str;
1779
+ }
1780
+ if (this.reportError) {
1781
+ cb(null, rtValue);
1782
+ return;
1783
+ }
1784
+ cb(rtValue);
1780
1785
  };
1781
-
1782
1786
  this.conn.run(toJson); // Post the input XML and get the response.
1783
1787
  }
1784
1788
 
@@ -1965,88 +1969,89 @@ class iObj {
1965
1969
  cb(null);
1966
1970
  return;
1967
1971
  }
1968
- parseString(str, (parseError, result) => {
1969
- if (parseError) {
1970
- if (this.reportError) {
1971
- cb(parseError, null);
1972
- return;
1973
- }
1974
- cb(str);
1975
- return;
1976
- }
1977
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1978
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1979
- rtValue = {
1980
- Program_name: data[2]._,
1981
- Program_library_name: data[3]._,
1982
- Program_owner: data[4]._,
1983
- Program_attribute: data[5]._,
1984
- Creation_date_and_time: data[6]._,
1985
- Source_file_name: data[7]._,
1986
- Source_file_library_name: data[8]._,
1987
- Source_file_member_name: data[9]._,
1988
- Source_file_updated_date_and_time: data[10]._,
1989
- Observable_information: data[11]._,
1990
- User_profile_option: data[12]._,
1991
- Use_adopted_authority: data[13]._,
1992
- Log_commands: data[14]._,
1993
- Allow_RTVCLSRC: data[15]._,
1994
- Fix_decimal_data: data[16]._,
1995
- Text_description: data[17]._,
1996
- Type_of_program: data[18]._,
1997
- 'Teraspace_storage-enabled_program': data[19]._,
1998
- Minimum_number_of_parameters: data[21]._,
1999
- Maximum_number_of_parameters: data[22]._,
2000
- Program_size: data[23]._,
2001
- Associated_space_size: data[24]._,
2002
- Static_storage_size: data[25]._,
2003
- Automatic_storage_size: data[26]._,
2004
- Number_of_MI_instructions: data[27]._,
2005
- Number_of_MI_ODT_entries: data[28]._,
2006
- Program_state: data[29]._,
2007
- Compiler_identification: data[30]._,
2008
- Earliest_release_program_can_run: data[31]._,
2009
- Sort_sequence_table_name: data[32]._,
2010
- Sort_sequence_table_library_name: data[33]._,
2011
- Language_identifier: data[34]._,
2012
- Program_domain: data[35]._,
2013
- Conversion_required: data[36]._,
2014
- Conversion_details: data[37]._,
2015
- Optimization: data[39]._,
2016
- Paging_pool: data[40]._,
2017
- 'Update_program_automatic_storage_area_(PASA)': data[41]._,
2018
- 'Clear_program_automatic_storage_area_(PASA)': data[42]._,
2019
- Paging_amount: data[43]._,
2020
- Program_entry_procedure_module: data[45]._,
2021
- Program_entry_procedure_module_library: data[46]._,
2022
- Activation_group_attribute: data[47]._,
2023
- Observable_information_compressed: data[48]._,
2024
- 'Run-time_information_compressed': data[49]._,
2025
- Release_program_created_on: data[50]._,
2026
- Shared_activation_group: data[51]._,
2027
- Allow_update: data[52]._,
2028
- Program_CCSID: data[53]._,
2029
- Number_of_modules: data[54]._,
2030
- Number_of_service_programs: data[55]._,
2031
- Number_of_copyrights: data[56]._,
2032
- Number_of_unresolved_references: data[57]._,
2033
- Release_program_created_for: data[58]._,
2034
- Allow_static_storage_reinitialization: data[59]._,
2035
- All_creation_data: data[60]._,
2036
- 'Allow_bound_*SRVPGM_library_name_update': data[61]._,
2037
- Profiling_data: data[62]._,
2038
- Teraspace_storage_enabled_modules: data[63]._,
2039
- Storage_model: data[64]._,
2040
- 'Uses_argument_optimization_(ARGOPT)': data[65]._,
2041
- };
2042
- } else { rtValue = str; }
2043
-
1972
+ const parser = new XMLParser();
1973
+ const result = parser.parse(str);
1974
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2044
1975
  if (this.reportError) {
2045
- cb(null, rtValue);
1976
+ cb(Error('Unable to parse the xml input'), null);
2046
1977
  return;
2047
1978
  }
2048
- cb(rtValue);
2049
- });
1979
+ cb(str);
1980
+ return;
1981
+ }
1982
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
1983
+ const { data } = result.myscript.pgm.parm[0].ds;
1984
+ rtValue = {
1985
+ Program_name: data[2],
1986
+ Program_library_name: data[3],
1987
+ Program_owner: data[4],
1988
+ Program_attribute: data[5],
1989
+ Creation_date_and_time: data[6],
1990
+ Source_file_name: data[7],
1991
+ Source_file_library_name: data[8],
1992
+ Source_file_member_name: data[9],
1993
+ Source_file_updated_date_and_time: data[10],
1994
+ Observable_information: data[11],
1995
+ User_profile_option: data[12],
1996
+ Use_adopted_authority: data[13],
1997
+ Log_commands: data[14],
1998
+ Allow_RTVCLSRC: data[15],
1999
+ Fix_decimal_data: data[16],
2000
+ Text_description: data[17],
2001
+ Type_of_program: data[18],
2002
+ 'Teraspace_storage-enabled_program': data[19],
2003
+ Minimum_number_of_parameters: data[21],
2004
+ Maximum_number_of_parameters: data[22],
2005
+ Program_size: data[23],
2006
+ Associated_space_size: data[24],
2007
+ Static_storage_size: data[25],
2008
+ Automatic_storage_size: data[26],
2009
+ Number_of_MI_instructions: data[27],
2010
+ Number_of_MI_ODT_entries: data[28],
2011
+ Program_state: data[29],
2012
+ Compiler_identification: data[30],
2013
+ Earliest_release_program_can_run: data[31],
2014
+ Sort_sequence_table_name: data[32],
2015
+ Sort_sequence_table_library_name: data[33],
2016
+ Language_identifier: data[34],
2017
+ Program_domain: data[35],
2018
+ Conversion_required: data[36],
2019
+ Conversion_details: data[37],
2020
+ Optimization: data[39],
2021
+ Paging_pool: data[40],
2022
+ 'Update_program_automatic_storage_area_(PASA)': data[41],
2023
+ 'Clear_program_automatic_storage_area_(PASA)': data[42],
2024
+ Paging_amount: data[43],
2025
+ Program_entry_procedure_module: data[45],
2026
+ Program_entry_procedure_module_library: data[46],
2027
+ Activation_group_attribute: data[47],
2028
+ Observable_information_compressed: data[48],
2029
+ 'Run-time_information_compressed': data[49],
2030
+ Release_program_created_on: data[50],
2031
+ Shared_activation_group: data[51],
2032
+ Allow_update: data[52],
2033
+ Program_CCSID: data[53],
2034
+ Number_of_modules: data[54],
2035
+ Number_of_service_programs: data[55],
2036
+ Number_of_copyrights: data[56],
2037
+ Number_of_unresolved_references: data[57],
2038
+ Release_program_created_for: data[58],
2039
+ Allow_static_storage_reinitialization: data[59],
2040
+ All_creation_data: data[60],
2041
+ 'Allow_bound_*SRVPGM_library_name_update': data[61],
2042
+ Profiling_data: data[62],
2043
+ Teraspace_storage_enabled_modules: data[63],
2044
+ Storage_model: data[64],
2045
+ 'Uses_argument_optimization_(ARGOPT)': data[65],
2046
+ };
2047
+ } else {
2048
+ rtValue = str;
2049
+ }
2050
+ if (this.reportError) {
2051
+ cb(null, rtValue);
2052
+ return;
2053
+ }
2054
+ cb(rtValue);
2050
2055
  };
2051
2056
 
2052
2057
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2193,69 +2198,69 @@ class iObj {
2193
2198
  cb(null);
2194
2199
  return;
2195
2200
  }
2196
- parseString(str, (parseError, result) => {
2197
- if (parseError) {
2198
- if (this.reportError) {
2199
- cb(parseError, null);
2200
- return;
2201
- }
2202
- cb(str);
2203
- return;
2204
- }
2205
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2206
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2207
-
2208
- rtValue = {
2209
- Service_program_name: data[2]._,
2210
- Service_program_library_name: data[3]._,
2211
- Service_program_owner: data[4]._,
2212
- Service_program_attribute: data[5]._,
2213
- Creation_date_and_time: data[6]._,
2214
- Export_source_file_name: data[7]._,
2215
- Export_source_file_library_name: data[8]._,
2216
- Export_source_file_member_name: data[9]._,
2217
- Activation_group_attribute: data[10]._,
2218
- Current_export_signature: data[11]._,
2219
- User_profile: data[12]._,
2220
- Observable_information_compressed: data[13]._,
2221
- 'Run-time_information_compressed': data[14]._,
2222
- Service_program_CCSID: data[15]._,
2223
- Number_of_modules: data[16]._,
2224
- Number_of_service_programs: data[17]._,
2225
- Number_of_copyrights: data[18]._,
2226
- Text_description: data[19]._,
2227
- Shared_activation_group: data[20]._,
2228
- Allow_update: data[21]._,
2229
- Number_of_unresolved_references: data[22]._,
2230
- Use_adopted_authority: data[23]._,
2231
- 'Allow_bound_*SRVPGM_library_name_update': data[24]._,
2232
- Profiling_data: data[25]._,
2233
- Teraspace_storage_enabled_modules: data[26]._,
2234
- Storage_model: data[27]._,
2235
- 'Uses_argument_optimization_(ARGOPT)': data[28]._,
2236
- Service_program_state: data[30]._,
2237
- Service_program_domain: data[31]._,
2238
- Associated_space_size: data[32]._,
2239
- Static_storage_size: data[33]._,
2240
- Service_program_size: data[34]._,
2241
- Release_service_program_created_on: data[35]._,
2242
- Earliest_release_service_program_can_run: data[36]._,
2243
- Release_service_program_created_for: data[37]._,
2244
- Allow_static_storage_reinitialization: data[38]._,
2245
- Conversion_required: data[39]._,
2246
- All_creation_data: data[40]._,
2247
- Conversion_details: data[41]._,
2248
- Paging_pool: data[43]._,
2249
- Paging_amount: data[44]._,
2250
- };
2251
- } else { rtValue = str; }
2252
-
2201
+ const parser = new XMLParser();
2202
+ const result = parser.parse(str);
2203
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2253
2204
  if (this.reportError) {
2254
- cb(null, rtValue);
2205
+ cb(Error('Unable to parse the xml input'), null);
2255
2206
  return;
2256
2207
  }
2257
- cb(rtValue);
2258
- });
2208
+ cb(str);
2209
+ return;
2210
+ }
2211
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
2212
+ const { data } = result.myscript.pgm.parm[0].ds;
2213
+ rtValue = {
2214
+ Service_program_name: data[2],
2215
+ Service_program_library_name: data[3],
2216
+ Service_program_owner: data[4],
2217
+ Service_program_attribute: data[5],
2218
+ Creation_date_and_time: data[6],
2219
+ Export_source_file_name: data[7],
2220
+ Export_source_file_library_name: data[8],
2221
+ Export_source_file_member_name: data[9],
2222
+ Activation_group_attribute: data[10],
2223
+ Current_export_signature: data[11],
2224
+ User_profile: data[12],
2225
+ Observable_information_compressed: data[13],
2226
+ 'Run-time_information_compressed': data[14],
2227
+ Service_program_CCSID: data[15],
2228
+ Number_of_modules: data[16],
2229
+ Number_of_service_programs: data[17],
2230
+ Number_of_copyrights: data[18],
2231
+ Text_description: data[19],
2232
+ Shared_activation_group: data[20],
2233
+ Allow_update: data[21],
2234
+ Number_of_unresolved_references: data[22],
2235
+ Use_adopted_authority: data[23],
2236
+ 'Allow_bound_*SRVPGM_library_name_update': data[24],
2237
+ Profiling_data: data[25],
2238
+ Teraspace_storage_enabled_modules: data[26],
2239
+ Storage_model: data[27],
2240
+ 'Uses_argument_optimization_(ARGOPT)': data[28],
2241
+ Service_program_state: data[30],
2242
+ Service_program_domain: data[31],
2243
+ Associated_space_size: data[32],
2244
+ Static_storage_size: data[33],
2245
+ Service_program_size: data[34],
2246
+ Release_service_program_created_on: data[35],
2247
+ Earliest_release_service_program_can_run: data[36],
2248
+ Release_service_program_created_for: data[37],
2249
+ Allow_static_storage_reinitialization: data[38],
2250
+ Conversion_required: data[39],
2251
+ All_creation_data: data[40],
2252
+ Conversion_details: data[41],
2253
+ Paging_pool: data[43],
2254
+ Paging_amount: data[44],
2255
+ };
2256
+ } else {
2257
+ rtValue = str;
2258
+ }
2259
+ if (this.reportError) {
2260
+ cb(null, rtValue);
2261
+ return;
2262
+ }
2263
+ cb(rtValue);
2259
2264
  };
2260
2265
 
2261
2266
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2338,40 +2343,41 @@ class iObj {
2338
2343
  cb(null);
2339
2344
  return;
2340
2345
  }
2341
- parseString(str, (parseError, result) => {
2342
- if (parseError) {
2343
- if (this.reportError) {
2344
- cb(parseError, null);
2345
- return;
2346
- }
2347
- cb(str);
2348
- return;
2349
- }
2350
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2351
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2352
- rtValue = {
2353
- User_profile_name: data[2]._,
2354
- 'Previous_sign-on_date_and_time': data[3]._,
2355
- 'Sign-on_attempts_not_valid': data[5]._,
2356
- Status: data[6]._,
2357
- Password_change_date: data[7]._,
2358
- No_password_indicator: data[8]._,
2359
- Password_expiration_interval: data[10]._,
2360
- Date_password_expires: data[11]._,
2361
- Days_until_password_expires: data[12]._,
2362
- Set_password_to_expire: data[13]._,
2363
- 'Display_sign-on_information': data[14]._,
2364
- Local_password_management: data[15]._,
2365
- Block_password_change: data[16]._,
2366
- };
2367
- } else { rtValue = str; }
2368
-
2346
+ const parser = new XMLParser();
2347
+ const result = parser.parse(str);
2348
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2369
2349
  if (this.reportError) {
2370
- cb(null, rtValue);
2350
+ cb(Error('Unable to parse the xml input'), null);
2371
2351
  return;
2372
2352
  }
2373
- cb(rtValue);
2374
- });
2353
+ cb(str);
2354
+ return;
2355
+ }
2356
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
2357
+ const { data } = result.myscript.pgm.parm[0].ds;
2358
+ rtValue = {
2359
+ User_profile_name: data[2],
2360
+ 'Previous_sign-on_date_and_time': data[3],
2361
+ 'Sign-on_attempts_not_valid': data[5],
2362
+ Status: data[6],
2363
+ Password_change_date: data[7],
2364
+ No_password_indicator: data[8],
2365
+ Password_expiration_interval: data[10],
2366
+ Date_password_expires: data[11],
2367
+ Days_until_password_expires: data[12],
2368
+ Set_password_to_expire: data[13],
2369
+ 'Display_sign-on_information': data[14],
2370
+ Local_password_management: data[15],
2371
+ Block_password_change: data[16],
2372
+ };
2373
+ } else {
2374
+ rtValue = str;
2375
+ }
2376
+ if (this.reportError) {
2377
+ cb(null, rtValue);
2378
+ return;
2379
+ }
2380
+ cb(rtValue);
2375
2381
  };
2376
2382
 
2377
2383
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2475,41 +2481,42 @@ class iObj {
2475
2481
  cb(null);
2476
2482
  return;
2477
2483
  }
2478
- parseString(str, (parseError, result) => {
2479
- if (parseError) {
2480
- if (this.reportError) {
2481
- cb(parseError, null);
2482
- return;
2483
- }
2484
- cb(str);
2485
- return;
2486
- }
2487
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2488
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2489
- rtValue = {
2490
- Profile_name: data[0]._,
2491
- User_or_group_indicator: data[1]._,
2492
- Data_authority: data[2]._,
2493
- Authorization_list_management: data[3]._,
2494
- Object_management: data[4]._,
2495
- Object_existence: data[5]._,
2496
- Object_alter: data[6]._,
2497
- Object_reference: data[7]._,
2498
- Object_operational: data[9]._,
2499
- Data_read: data[10]._,
2500
- Data_add: data[11]._,
2501
- Data_update: data[12]._,
2502
- Data_delete: data[13]._,
2503
- Data_execute: data[14]._,
2504
- };
2505
- } else { rtValue = str; }
2506
-
2484
+ const parser = new XMLParser();
2485
+ const result = parser.parse(str);
2486
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2507
2487
  if (this.reportError) {
2508
- cb(null, rtValue);
2488
+ cb(Error('Unable to parse the xml input'), null);
2509
2489
  return;
2510
2490
  }
2511
- cb(rtValue);
2512
- });
2491
+ cb(str);
2492
+ return;
2493
+ }
2494
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
2495
+ const { data } = result.myscript.pgm.parm[0].ds;
2496
+ rtValue = {
2497
+ Profile_name: data[0],
2498
+ User_or_group_indicator: data[1],
2499
+ Data_authority: data[2],
2500
+ Authorization_list_management: data[3],
2501
+ Object_management: data[4],
2502
+ Object_existence: data[5],
2503
+ Object_alter: data[6],
2504
+ Object_reference: data[7],
2505
+ Object_operational: data[9],
2506
+ Data_read: data[10],
2507
+ Data_add: data[11],
2508
+ Data_update: data[12],
2509
+ Data_delete: data[13],
2510
+ Data_execute: data[14],
2511
+ };
2512
+ } else {
2513
+ rtValue = str;
2514
+ }
2515
+ if (this.reportError) {
2516
+ cb(null, rtValue);
2517
+ return;
2518
+ }
2519
+ cb(rtValue);
2513
2520
  };
2514
2521
 
2515
2522
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2690,56 +2697,57 @@ class iProd {
2690
2697
  cb(null);
2691
2698
  return;
2692
2699
  }
2693
- parseString(str, (parseError, result) => {
2694
- if (parseError) {
2695
- if (this.reportError) {
2696
- cb(parseError, null);
2697
- return;
2698
- }
2699
- cb(null);
2700
- return;
2701
- }
2702
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2703
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2704
- rtValue = {
2705
- Product_ID: data[3]._,
2706
- PTF_ID: data[4]._,
2707
- Release_level: data[5]._,
2708
- Product_option: data[6]._,
2709
- Load_ID: data[7]._,
2710
- Loaded_status: data[8]._,
2711
- Cover_letter_status: data[9]._,
2712
- 'On-order_status': data[10]._,
2713
- Save_file_status: data[11]._,
2714
- File_name: data[12]._,
2715
- File_library_name: data[13]._,
2716
- PTF_type: data[14]._,
2717
- IPL_action: data[15]._,
2718
- Action_pending: data[16]._,
2719
- Action_required: data[17]._,
2720
- PTF_is_released: data[18]._,
2721
- Target_release: data[19]._,
2722
- Superseding_PTF: data[20]._,
2723
- Current_IPL_source: data[21]._,
2724
- Minimum_level: data[22]._,
2725
- Maximum_level: data[23]._,
2726
- Format_information_available: data[24]._,
2727
- Status_date_and_time: data[25]._,
2728
- Licensed_Internal_Code_group: data[26]._,
2729
- Superseded_by_PTF_ID: data[27]._,
2730
- Current_server_IPL_source: data[28]._,
2731
- Server_IPL_required: data[29]._,
2732
- Creation_date_and_time: data[30]._,
2733
- Technology_refresh_PTF: data[31]._,
2734
- };
2735
- } else { rtValue = str; }
2736
-
2700
+ const parser = new XMLParser();
2701
+ const result = parser.parse(str);
2702
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2737
2703
  if (this.reportError) {
2738
- cb(null, rtValue);
2704
+ cb(Error('Unable to parse the xml input'), null);
2739
2705
  return;
2740
2706
  }
2741
- cb(rtValue);
2742
- });
2707
+ cb(str);
2708
+ return;
2709
+ }
2710
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
2711
+ const { data } = result.myscript.pgm.parm[0].ds;
2712
+ rtValue = {
2713
+ Product_ID: data[3],
2714
+ PTF_ID: data[4],
2715
+ Release_level: data[5],
2716
+ Product_option: data[6],
2717
+ Load_ID: data[7],
2718
+ Loaded_status: data[8],
2719
+ Cover_letter_status: data[9],
2720
+ 'On-order_status': data[10],
2721
+ Save_file_status: data[11],
2722
+ File_name: data[12],
2723
+ File_library_name: data[13],
2724
+ PTF_type: data[14],
2725
+ IPL_action: data[15],
2726
+ Action_pending: data[16],
2727
+ Action_required: data[17],
2728
+ PTF_is_released: data[18],
2729
+ Target_release: data[19],
2730
+ Superseding_PTF: data[20],
2731
+ Current_IPL_source: data[21],
2732
+ Minimum_level: data[22],
2733
+ Maximum_level: data[23],
2734
+ Format_information_available: data[24],
2735
+ Status_date_and_time: data[25],
2736
+ Licensed_Internal_Code_group: data[26],
2737
+ Superseded_by_PTF_ID: data[27],
2738
+ Current_server_IPL_source: data[28],
2739
+ Server_IPL_required: data[29],
2740
+ Creation_date_and_time: data[30],
2741
+ Technology_refresh_PTF: data[31],
2742
+ };
2743
+ } else {
2744
+ rtValue = str;
2745
+ }
2746
+ if (this.reportError) {
2747
+ cb(null, rtValue);
2748
+ return;
2749
+ }
2750
+ cb(rtValue);
2743
2751
  };
2744
2752
 
2745
2753
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2865,45 +2873,45 @@ class iProd {
2865
2873
  callback(null);
2866
2874
  return;
2867
2875
  }
2868
- parseString(str, (parseError, result) => {
2869
- if (parseError) {
2870
- if (this.reportError) {
2871
- callback(parseError, null);
2872
- return;
2873
- }
2874
- callback(null);
2875
- return;
2876
- }
2877
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2878
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2879
-
2880
- rtValue = {
2881
- Product_ID: data[3]._,
2882
- Release_level: data[4]._,
2883
- Product_option: data[5]._,
2884
- Load_ID: data[6]._,
2885
- Load_type: data[7]._,
2886
- Symbolic_load_state: data[8]._,
2887
- Load_error_indicator: data[9]._,
2888
- Load_state: data[10]._,
2889
- Supported_flag: data[11]._,
2890
- Registration_type: data[12]._,
2891
- Registration_value: data[13]._,
2892
- Offset_to_additional_information: data[15]._,
2893
- Primary_language_load_identifier: data[16]._,
2894
- Minimum_target_release: data[17]._,
2895
- 'Minimum_VRM_of_*BASE_required_by_option': data[18]._,
2896
- Requirements_met_between_base_and_option_value: data[19]._,
2897
- Level: data[20]._,
2898
- };
2899
- } else { rtValue = str; }
2900
-
2876
+ const parser = new XMLParser();
2877
+ const result = parser.parse(str);
2878
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2901
2879
  if (this.reportError) {
2902
- callback(null, rtValue);
2880
+ cb(Error('Unable to parse the xml input'), null);
2903
2881
  return;
2904
2882
  }
2905
- callback(rtValue);
2906
- });
2883
+ cb(str);
2884
+ return;
2885
+ }
2886
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
2887
+ const { data } = result.myscript.pgm.parm[0].ds;
2888
+ rtValue = {
2889
+ Product_ID: data[3],
2890
+ Release_level: data[4],
2891
+ Product_option: data[5],
2892
+ Load_ID: data[6],
2893
+ Load_type: data[7],
2894
+ Symbolic_load_state: data[8],
2895
+ Load_error_indicator: data[9],
2896
+ Load_state: data[10],
2897
+ Supported_flag: data[11],
2898
+ Registration_type: data[12],
2899
+ Registration_value: data[13],
2900
+ Offset_to_additional_information: data[15],
2901
+ Primary_language_load_identifier: data[16],
2902
+ Minimum_target_release: data[17],
2903
+ 'Minimum_VRM_of_*BASE_required_by_option': data[18],
2904
+ Requirements_met_between_base_and_option_value: data[19],
2905
+ Level: data[20],
2906
+ };
2907
+ } else {
2908
+ rtValue = str;
2909
+ }
2910
+ if (this.reportError) {
2911
+ callback(null, rtValue);
2912
+ return;
2913
+ }
2914
+ callback(rtValue);
2907
2915
  };
2908
2916
 
2909
2917
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3009,42 +3017,42 @@ class iProd {
3009
3017
  cb(null);
3010
3018
  return;
3011
3019
  }
3012
- parseString(str, (parseError, result) => {
3013
- if (parseError) {
3014
- if (this.reportError) {
3015
- cb(parseError, null);
3016
- return;
3017
- }
3018
- cb(str);
3019
- return;
3020
- }
3021
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3022
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3023
- const count = result.myscript.pgm[0].parm[4].ds[0].data[1]._;
3024
-
3025
- for (let i = 0; i < count * 12; i += 12) {
3026
- rtValue.push({
3027
- Product_ID: data[i]._,
3028
- Product_option: data[i + 1]._,
3029
- Release_level: data[i + 2]._,
3030
- Description_text_message_ID: data[i + 4]._,
3031
- Description_text_object_name: data[i + 5]._,
3032
- Description_text_library_name: data[i + 6]._,
3033
- Installed_flag: data[i + 7]._,
3034
- Supported_flag: data[i + 8]._,
3035
- Registration_type: data[i + 9]._,
3036
- Registration_value: data[i + 10]._,
3037
- Description_text: data[i + 11]._,
3038
- });
3039
- }
3040
- } else { rtValue = str; }
3041
-
3020
+ const parser = new XMLParser();
3021
+ const result = parser.parse(str);
3022
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3042
3023
  if (this.reportError) {
3043
- cb(null, rtValue);
3024
+ cb(Error('Unable to parse the xml input'), null);
3044
3025
  return;
3045
3026
  }
3046
- cb(rtValue);
3047
- });
3027
+ cb(str);
3028
+ return;
3029
+ }
3030
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3031
+ const { data } = result.myscript.pgm.parm[0].ds;
3032
+ const count = result.myscript.pgm.parm[4].ds.data[1];
3033
+ for (let i = 0; i < count * 12; i += 12) {
3034
+ rtValue.push({
3035
+ Product_ID: data[i],
3036
+ Product_option: data[i + 1],
3037
+ Release_level: data[i + 2],
3038
+ Description_text_message_ID: data[i + 4],
3039
+ Description_text_object_name: data[i + 5],
3040
+ Description_text_library_name: data[i + 6],
3041
+ Installed_flag: data[i + 7],
3042
+ Supported_flag: data[i + 8],
3043
+ Registration_type: data[i + 9],
3044
+ Registration_value: data[i + 10],
3045
+ Description_text: data[i + 11],
3046
+ });
3047
+ }
3048
+ } else {
3049
+ rtValue = str;
3050
+ }
3051
+ if (this.reportError) {
3052
+ cb(null, rtValue);
3053
+ return;
3054
+ }
3055
+ cb(rtValue);
3048
3056
  };
3049
3057
 
3050
3058
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3147,27 +3155,26 @@ class iUserSpace {
3147
3155
  cb(null);
3148
3156
  return;
3149
3157
  }
3150
- parseString(str, (parseError, result) => {
3151
- if (parseError) {
3152
- if (this.reportError) {
3153
- cb(parseError, null);
3154
- return;
3155
- }
3156
- cb(str);
3157
- return;
3158
- }
3159
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3160
- rtValue = true;
3161
- } else {
3162
- rtValue = str;
3163
- }
3164
-
3158
+ const parser = new XMLParser();
3159
+ const result = parser.parse(str);
3160
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3165
3161
  if (this.reportError) {
3166
- cb(null, rtValue);
3162
+ cb(Error('Unable to parse the xml input'), null);
3167
3163
  return;
3168
3164
  }
3169
- cb(rtValue);
3170
- });
3165
+ cb(str);
3166
+ return;
3167
+ }
3168
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3169
+ rtValue = true;
3170
+ } else {
3171
+ rtValue = str;
3172
+ }
3173
+ if (this.reportError) {
3174
+ cb(null, rtValue);
3175
+ return;
3176
+ }
3177
+ cb(rtValue);
3171
3178
  };
3172
3179
 
3173
3180
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3219,26 +3226,26 @@ class iUserSpace {
3219
3226
  cb(null);
3220
3227
  return;
3221
3228
  }
3222
- parseString(str, (parseError, result) => {
3223
- if (parseError) {
3224
- if (this.reportError) {
3225
- cb(parseError, null);
3226
- return;
3227
- }
3228
- cb(str);
3229
- return;
3230
- }
3231
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3232
- rtValue = true;
3233
- } else {
3234
- rtValue = str;
3235
- }
3229
+ const parser = new XMLParser();
3230
+ const result = parser.parse(str);
3231
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3236
3232
  if (this.reportError) {
3237
- cb(null, rtValue);
3233
+ cb(Error('Unable to parse the xml input'), null);
3238
3234
  return;
3239
3235
  }
3240
- cb(rtValue);
3241
- });
3236
+ cb(str);
3237
+ return;
3238
+ }
3239
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3240
+ rtValue = true;
3241
+ } else {
3242
+ rtValue = str;
3243
+ }
3244
+ if (this.reportError) {
3245
+ cb(null, rtValue);
3246
+ return;
3247
+ }
3248
+ cb(rtValue);
3242
3249
  };
3243
3250
 
3244
3251
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3289,27 +3296,27 @@ class iUserSpace {
3289
3296
  cb(null);
3290
3297
  return;
3291
3298
  }
3292
- parseString(str, (parseError, result) => {
3293
- if (parseError) {
3294
- if (this.reportError) {
3295
- cb(parseError, null);
3296
- return;
3297
- }
3298
- cb(str);
3299
- return;
3300
- }
3301
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3302
- const { data } = result.myscript.pgm[0].parm[3];
3303
- rtValue = data[0]._;
3304
- } else {
3305
- rtValue = str;
3306
- }
3299
+ const parser = new XMLParser();
3300
+ const result = parser.parse(str);
3301
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3307
3302
  if (this.reportError) {
3308
- cb(null, rtValue);
3303
+ cb(Error('Unable to parse the xml input'), null);
3309
3304
  return;
3310
3305
  }
3311
- cb(rtValue);
3312
- });
3306
+ cb(str);
3307
+ return;
3308
+ }
3309
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3310
+ const { data } = result.myscript.pgm.parm[3];
3311
+ rtValue = data;
3312
+ } else {
3313
+ rtValue = str;
3314
+ }
3315
+ if (this.reportError) {
3316
+ cb(null, rtValue);
3317
+ return;
3318
+ }
3319
+ cb(rtValue);
3313
3320
  };
3314
3321
 
3315
3322
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3355,25 +3362,27 @@ class iUserSpace {
3355
3362
  cb(null);
3356
3363
  return;
3357
3364
  }
3358
- parseString(str, (parseError, result) => {
3359
- if (parseError) {
3360
- if (this.reportError) {
3361
- cb(parseError, null);
3362
- return;
3363
- }
3364
- cb(str);
3365
- return;
3366
- }
3367
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3368
- rtValue = true;
3369
- } else { rtValue = str; }
3370
3365
 
3366
+ const parser = new XMLParser();
3367
+ const result = parser.parse(str);
3368
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3371
3369
  if (this.reportError) {
3372
- cb(null, rtValue);
3370
+ cb(Error('Unable to parse the xml input'), null);
3373
3371
  return;
3374
3372
  }
3375
- cb(rtValue);
3376
- });
3373
+ cb(str);
3374
+ return;
3375
+ }
3376
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3377
+ rtValue = true;
3378
+ } else {
3379
+ rtValue = str;
3380
+ }
3381
+ if (this.reportError) {
3382
+ cb(null, rtValue);
3383
+ return;
3384
+ }
3385
+ cb(rtValue);
3377
3386
  };
3378
3387
 
3379
3388
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3532,27 +3541,28 @@ class iWork {
3532
3541
  cb(null);
3533
3542
  return;
3534
3543
  }
3535
- parseString(str, (parseError, result) => {
3536
- if (parseError) {
3537
- if (this.reportError) {
3538
- cb(parseError, null);
3539
- return;
3540
- }
3541
- cb(str);
3542
- return;
3543
- }
3544
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3545
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3546
- rtValue = data[6]._; // Get the returned value from the output array.
3547
- } else {
3548
- rtValue = str;
3549
- }
3544
+ const parser = new XMLParser();
3545
+ const result = parser.parse(str);
3546
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3550
3547
  if (this.reportError) {
3551
- cb(null, rtValue);
3548
+ cb(Error('Unable to parse the xml input'), null);
3552
3549
  return;
3553
3550
  }
3554
- cb(rtValue);
3555
- });
3551
+ cb(str);
3552
+ return;
3553
+ }
3554
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3555
+ const { data } = result.myscript.pgm.parm[0].ds;
3556
+ [, , , , , , rtValue] = data; // Get the returned value from the output array.
3557
+ rtValue = rtValue.toString();
3558
+ } else {
3559
+ rtValue = str;
3560
+ }
3561
+ if (this.reportError) {
3562
+ cb(null, rtValue);
3563
+ return;
3564
+ }
3565
+ cb(rtValue);
3556
3566
  };
3557
3567
 
3558
3568
  this.conn.run(toJson); // Post the input XML
@@ -3638,43 +3648,46 @@ class iWork {
3638
3648
  cb(null);
3639
3649
  return;
3640
3650
  }
3641
- parseString(str, (parseError, result) => {
3642
- if (parseError) {
3643
- if (this.reportError) {
3644
- cb(parseError, null);
3645
- return;
3646
- }
3647
- cb(str);
3648
- return;
3649
- }
3650
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3651
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3652
- rtValue = {
3653
- Current_date_and_time: data[2]._,
3654
- System_name: data[3]._,
3655
- Users_currently_signed_on: data[4]._,
3656
- 'Users_temporarily_signed_off_(disconnected)': data[5]._,
3657
- Users_suspended_by_system_request: data[6]._,
3658
- Users_suspended_by_group_jobs: data[7]._,
3659
- Users_signed_off_with_printer_output_waiting_to_print: data[8]._,
3660
- Batch_jobs_waiting_for_messages: data[9]._,
3661
- Batch_jobs_running: data[10]._,
3662
- Batch_jobs_held_while_running: data[11]._,
3663
- Batch_jobs_ending: data[12]._,
3664
- Batch_jobs_waiting_to_run_or_already_scheduled: data[13]._,
3665
- Batch_jobs_held_on_a_job_queue: data[14]._,
3666
- Batch_jobs_on_a_held_job_queue: data[15]._,
3667
- Batch_jobs_on_an_unassigned_job_queue: data[16]._,
3668
- Batch_jobs_ended_with_printer_output_waiting_to_print: data[17]._,
3669
- };
3670
- } else { rtValue = str; }
3671
3651
 
3652
+ const parser = new XMLParser();
3653
+ const result = parser.parse(str);
3654
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3672
3655
  if (this.reportError) {
3673
- cb(null, rtValue);
3656
+ cb(Error('Unable to parse the xml input'), null);
3674
3657
  return;
3675
3658
  }
3676
- cb(rtValue);
3677
- });
3659
+ cb(str);
3660
+ return;
3661
+ }
3662
+
3663
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3664
+ const { data } = result.myscript.pgm.parm[0].ds;
3665
+ rtValue = {
3666
+ Current_date_and_time: data[2],
3667
+ System_name: data[3],
3668
+ Users_currently_signed_on: data[4],
3669
+ 'Users_temporarily_signed_off_(disconnected)': data[5],
3670
+ Users_suspended_by_system_request: data[6],
3671
+ Users_suspended_by_group_jobs: data[7],
3672
+ Users_signed_off_with_printer_output_waiting_to_print: data[8],
3673
+ Batch_jobs_waiting_for_messages: data[9],
3674
+ Batch_jobs_running: data[10],
3675
+ Batch_jobs_held_while_running: data[11],
3676
+ Batch_jobs_ending: data[12],
3677
+ Batch_jobs_waiting_to_run_or_already_scheduled: data[13],
3678
+ Batch_jobs_held_on_a_job_queue: data[14],
3679
+ Batch_jobs_on_a_held_job_queue: data[15],
3680
+ Batch_jobs_on_an_unassigned_job_queue: data[16],
3681
+ Batch_jobs_ended_with_printer_output_waiting_to_print: data[17],
3682
+ };
3683
+ } else {
3684
+ rtValue = str;
3685
+ }
3686
+ if (this.reportError) {
3687
+ cb(null, rtValue);
3688
+ return;
3689
+ }
3690
+ cb(rtValue);
3678
3691
  };
3679
3692
 
3680
3693
  this.conn.run(toJson);
@@ -3793,59 +3806,60 @@ class iWork {
3793
3806
  cb(null);
3794
3807
  return;
3795
3808
  }
3796
- parseString(str, (parseError, result) => {
3797
- if (parseError) {
3798
- if (this.reportError) {
3799
- cb(parseError, null);
3800
- return;
3801
- }
3802
- cb(str);
3803
- return;
3804
- }
3805
-
3806
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3807
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3808
- rtValue = {
3809
- Current_date_and_time: data[2]._,
3810
- System_name: data[3]._,
3811
- Elapsed_time: data[4]._,
3812
- Restricted_state_flag: data[5]._,
3813
- '%_processing_unit_used': data[7]._,
3814
- Jobs_in_system: data[8]._,
3815
- '%_permanent_addresses': data[9]._,
3816
- '%_temporary_addresses': data[10]._,
3817
- System_ASP: data[11]._,
3818
- '%_system_ASP_used': data[12]._,
3819
- Total_auxiliary_storage: data[13]._,
3820
- Current_unprotected_storage_used: data[14]._,
3821
- Maximum_unprotected_storage_used: data[15]._,
3822
- '%_DB_capability': data[16]._,
3823
- Main_storage_size: data[17]._,
3824
- Number_of_partitions: data[18]._,
3825
- Partition_identifier: data[19]._,
3826
- Current_processing_capacity: data[21]._,
3827
- Processor_sharing_attribute: data[22]._,
3828
- Number_of_processors: data[24]._,
3829
- Active_jobs_in_system: data[25]._,
3830
- Active_threads_in_system: data[26]._,
3831
- Maximum_jobs_in_system: data[27]._,
3832
- '%_temporary_256MB_segments_used': data[28]._,
3833
- '%_temporary_4GB_segments_used': data[29]._,
3834
- '%_permanent_256MB_segments_used': data[30]._,
3835
- '%_permanent_4GB_segments_used': data[31]._,
3836
- '%_current_interactive_performance': data[32]._,
3837
- '%_uncapped_CPU_capacity_used': data[33]._,
3838
- '%_shared_processor_pool_used': data[34]._,
3839
- 'Main_storage_size_(long)': data[35]._,
3840
- };
3841
- } else { rtValue = str; }
3842
3809
 
3810
+ const parser = new XMLParser();
3811
+ const result = parser.parse(str);
3812
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3843
3813
  if (this.reportError) {
3844
- cb(null, rtValue);
3814
+ cb(Error('Unable to parse the xml input'), null);
3845
3815
  return;
3846
3816
  }
3847
- cb(rtValue);
3848
- });
3817
+ cb(str);
3818
+ return;
3819
+ }
3820
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3821
+ const { data } = result.myscript.pgm.parm[0].ds;
3822
+ rtValue = {
3823
+ Current_date_and_time: data[2],
3824
+ System_name: data[3],
3825
+ Elapsed_time: data[4],
3826
+ Restricted_state_flag: data[5],
3827
+ '%_processing_unit_used': data[7],
3828
+ Jobs_in_system: data[8],
3829
+ '%_permanent_addresses': data[9],
3830
+ '%_temporary_addresses': data[10],
3831
+ System_ASP: data[11],
3832
+ '%_system_ASP_used': data[12],
3833
+ Total_auxiliary_storage: data[13],
3834
+ Current_unprotected_storage_used: data[14],
3835
+ Maximum_unprotected_storage_used: data[15],
3836
+ '%_DB_capability': data[16],
3837
+ Main_storage_size: data[17],
3838
+ Number_of_partitions: data[18],
3839
+ Partition_identifier: data[19],
3840
+ Current_processing_capacity: data[21],
3841
+ Processor_sharing_attribute: data[22],
3842
+ Number_of_processors: data[24],
3843
+ Active_jobs_in_system: data[25],
3844
+ Active_threads_in_system: data[26],
3845
+ Maximum_jobs_in_system: data[27],
3846
+ '%_temporary_256MB_segments_used': data[28],
3847
+ '%_temporary_4GB_segments_used': data[29],
3848
+ '%_permanent_256MB_segments_used': data[30],
3849
+ '%_permanent_4GB_segments_used': data[31],
3850
+ '%_current_interactive_performance': data[32],
3851
+ '%_uncapped_CPU_capacity_used': data[33],
3852
+ '%_shared_processor_pool_used': data[34],
3853
+ 'Main_storage_size_(long)': data[35],
3854
+ };
3855
+ } else {
3856
+ rtValue = str;
3857
+ }
3858
+ if (this.reportError) {
3859
+ cb(null, rtValue);
3860
+ return;
3861
+ }
3862
+ cb(rtValue);
3849
3863
  };
3850
3864
 
3851
3865
  this.conn.run(toJson);
@@ -3906,30 +3920,31 @@ class iWork {
3906
3920
  cb(null);
3907
3921
  return;
3908
3922
  }
3909
- parseString(str, (parseError, result) => {
3910
- if (parseError) {
3911
- if (this.reportError) {
3912
- cb(parseError, null);
3913
- return;
3914
- }
3915
- cb(str);
3916
- return;
3917
- }
3918
-
3919
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3920
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3921
- rtValue = {
3922
- Job_status: data[2]._,
3923
- Fully_qualified_job_name: data[4]._,
3924
- };
3925
- } else { rtValue = str; }
3926
3923
 
3924
+ const parser = new XMLParser();
3925
+ const result = parser.parse(str);
3926
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3927
3927
  if (this.reportError) {
3928
- cb(null, rtValue);
3928
+ cb(Error('Unable to parse the xml input'), null);
3929
3929
  return;
3930
3930
  }
3931
- cb(rtValue);
3932
- });
3931
+ cb(str);
3932
+ return;
3933
+ }
3934
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
3935
+ const { data } = result.myscript.pgm.parm[0].ds;
3936
+ rtValue = {
3937
+ Job_status: data[2],
3938
+ Fully_qualified_job_name: data[4],
3939
+ };
3940
+ } else {
3941
+ rtValue = str;
3942
+ }
3943
+ if (this.reportError) {
3944
+ cb(null, rtValue);
3945
+ return;
3946
+ }
3947
+ cb(rtValue);
3933
3948
  };
3934
3949
 
3935
3950
  this.conn.run(toJson);
@@ -4068,64 +4083,64 @@ class iWork {
4068
4083
  cb(null);
4069
4084
  return;
4070
4085
  }
4071
- parseString(str, (parseError, result) => {
4072
- if (parseError) {
4073
- if (this.reportError) {
4074
- cb(parseError, null);
4075
- return;
4076
- }
4077
- cb(str);
4078
- return;
4079
- }
4080
-
4081
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
4082
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
4083
-
4084
- rtValue = {
4085
- Job_name: data[2]._,
4086
- User_name: data[3]._,
4087
- Job_number: data[4]._,
4088
- Job_status: data[6]._,
4089
- Job_type: data[7]._,
4090
- Job_subtype: data[8]._,
4091
- Subsystem_description_name: data[9]._,
4092
- 'Run_priority_(job)': data[10]._,
4093
- System_pool_identifier: data[11]._,
4094
- 'Processing_unit_time_used,_if_less_than_2,147,483,647_milliseconds': data[12]._,
4095
- 'Number_of_auxiliary_I/O_requests,_if_less_than_2,147,483,647': data[13]._,
4096
- Number_of_interactive_transactions: data[14]._,
4097
- Response_time_total: data[15]._,
4098
- Function_type: data[16]._,
4099
- Function_name: data[17]._,
4100
- Active_job_status: data[18]._,
4101
- Number_of_database_lock_waits: data[19]._,
4102
- Number_of_internal_machine_lock_waits: data[20]._,
4103
- Number_of_nondatabase_lock_waits: data[21]._,
4104
- Time_spent_on_database_lock_waits: data[22]._,
4105
- Time_spent_on_internal_machine_lock_waits: data[23]._,
4106
- Time_spent_on_nondatabase_lock_waits: data[24]._,
4107
- Current_system_pool_identifier: data[26]._,
4108
- Thread_count: data[27]._,
4109
- 'Processing_unit_time_used_-_total_for_the_job': data[28]._,
4110
- 'Number_of_auxiliary_I/O_requests': data[29]._,
4111
- 'Processing_unit_time_used_for_database_-_total_for_the_job': data[30]._,
4112
- Page_faults: data[31]._,
4113
- Active_job_status_for_jobs_ending: data[32]._,
4114
- Memory_pool_name: data[33]._,
4115
- Message_reply: data[34]._,
4116
- 'Message_key,_when_active_job_waiting_for_a_message': data[35]._,
4117
- 'Message_queue_name,_when_active_job_waiting_for_a_message': data[36]._,
4118
- 'Message_queue_library_name,_when_active_job_waiting_for_a_message': data[37]._,
4119
- 'Message_queue_library_ASP_device_name,_when_active_job_waiting_for_a_message': data[38]._,
4120
- };
4121
- } else { rtValue = str; }
4122
4086
 
4087
+ const parser = new XMLParser();
4088
+ const result = parser.parse(str);
4089
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
4123
4090
  if (this.reportError) {
4124
- cb(null, rtValue);
4091
+ cb(Error('Unable to parse the xml input'), null);
4125
4092
  return;
4126
4093
  }
4127
- cb(rtValue);
4128
- });
4094
+ cb(str);
4095
+ return;
4096
+ }
4097
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
4098
+ const { data } = result.myscript.pgm.parm[0].ds;
4099
+ rtValue = {
4100
+ Job_name: data[2],
4101
+ User_name: data[3],
4102
+ Job_number: data[4],
4103
+ Job_status: data[6],
4104
+ Job_type: data[7],
4105
+ Job_subtype: data[8],
4106
+ Subsystem_description_name: data[9],
4107
+ 'Run_priority_(job)': data[10],
4108
+ System_pool_identifier: data[11],
4109
+ 'Processing_unit_time_used,_if_less_than_2,147,483,647_milliseconds': data[12],
4110
+ 'Number_of_auxiliary_I/O_requests,_if_less_than_2,147,483,647': data[13],
4111
+ Number_of_interactive_transactions: data[14],
4112
+ Response_time_total: data[15],
4113
+ Function_type: data[16],
4114
+ Function_name: data[17],
4115
+ Active_job_status: data[18],
4116
+ Number_of_database_lock_waits: data[19],
4117
+ Number_of_internal_machine_lock_waits: data[20],
4118
+ Number_of_nondatabase_lock_waits: data[21],
4119
+ Time_spent_on_database_lock_waits: data[22],
4120
+ Time_spent_on_internal_machine_lock_waits: data[23],
4121
+ Time_spent_on_nondatabase_lock_waits: data[24],
4122
+ Current_system_pool_identifier: data[26],
4123
+ Thread_count: data[27],
4124
+ 'Processing_unit_time_used_-_total_for_the_job': data[28],
4125
+ 'Number_of_auxiliary_I/O_requests': data[29],
4126
+ 'Processing_unit_time_used_for_database_-_total_for_the_job': data[30],
4127
+ Page_faults: data[31],
4128
+ Active_job_status_for_jobs_ending: data[32],
4129
+ Memory_pool_name: data[33],
4130
+ Message_reply: data[34],
4131
+ 'Message_key,_when_active_job_waiting_for_a_message': data[35],
4132
+ 'Message_queue_name,_when_active_job_waiting_for_a_message': data[36],
4133
+ 'Message_queue_library_name,_when_active_job_waiting_for_a_message': data[37],
4134
+ 'Message_queue_library_ASP_device_name,_when_active_job_waiting_for_a_message': data[38],
4135
+ };
4136
+ } else {
4137
+ rtValue = str;
4138
+ }
4139
+ if (this.reportError) {
4140
+ cb(null, rtValue);
4141
+ return;
4142
+ }
4143
+ cb(rtValue);
4129
4144
  };
4130
4145
  this.conn.run(toJson);
4131
4146
  }
@@ -4199,32 +4214,34 @@ class iWork {
4199
4214
  cb(null);
4200
4215
  return;
4201
4216
  }
4202
- parseString(str, (parseError, result) => {
4203
- if (parseError) {
4204
- if (this.reportError) {
4205
- cb(parseError, null);
4206
- return;
4207
- }
4208
- cb(str);
4209
- return;
4210
- }
4211
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
4212
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
4213
- rtValue = {
4214
- Type_of_value_returned: data[2]._,
4215
- Library_name: data[3]._,
4216
- Length_of_value_returned: data[4]._,
4217
- Number_of_decimal_positions: data[5]._,
4218
- Value: data[6]._,
4219
- };
4220
- } else { rtValue = str; }
4221
4217
 
4218
+ const parser = new XMLParser();
4219
+ const result = parser.parse(str);
4220
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
4222
4221
  if (this.reportError) {
4223
- cb(null, rtValue);
4222
+ cb(Error('Unable to parse the xml input'), null);
4224
4223
  return;
4225
4224
  }
4226
- cb(rtValue);
4227
- });
4225
+ cb(str);
4226
+ return;
4227
+ }
4228
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
4229
+ const { data } = result.myscript.pgm.parm[0].ds;
4230
+ rtValue = {
4231
+ Type_of_value_returned: data[2],
4232
+ Library_name: data[3],
4233
+ Length_of_value_returned: data[4],
4234
+ Number_of_decimal_positions: data[5],
4235
+ Value: data[6],
4236
+ };
4237
+ } else {
4238
+ rtValue = str;
4239
+ }
4240
+ if (this.reportError) {
4241
+ cb(null, rtValue);
4242
+ return;
4243
+ }
4244
+ cb(rtValue);
4228
4245
  };
4229
4246
  this.conn.run(toJson);
4230
4247
  }