itoolkit 1.0.1 → 1.1.0-rc.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 (46) hide show
  1. package/README.md +6 -2
  2. package/lib/CommandCall.js +2 -16
  3. package/lib/Connection.js +2 -16
  4. package/lib/Deprecated.js +892 -895
  5. package/lib/ProgramCall.js +2 -16
  6. package/lib/itoolkit.js +2 -16
  7. package/lib/transports/httpTransport.js +2 -16
  8. package/lib/transports/idbTransport.js +2 -16
  9. package/lib/transports/odbcTransport.js +2 -16
  10. package/lib/transports/sshTransport.js +2 -16
  11. package/package.json +21 -10
  12. package/.eslintrc.js +0 -39
  13. package/.gitattributes +0 -2
  14. package/.readthedocs.yml +0 -16
  15. package/CHANGELOG.md +0 -228
  16. package/contributors.txt +0 -2
  17. package/test/README.md +0 -44
  18. package/test/functional/CommandCallFunctional.js +0 -87
  19. package/test/functional/ProgramCallFunctional.js +0 -106
  20. package/test/functional/checkObjectExists.js +0 -193
  21. package/test/functional/checkVersion.js +0 -17
  22. package/test/functional/config.js +0 -35
  23. package/test/functional/deprecated/commandsFunctional.js +0 -108
  24. package/test/functional/deprecated/iDataQueueFunctional.js +0 -103
  25. package/test/functional/deprecated/iNetworkFunctional.js +0 -159
  26. package/test/functional/deprecated/iObjFunctional.js +0 -349
  27. package/test/functional/deprecated/iPgmFunctional.js +0 -104
  28. package/test/functional/deprecated/iProdFunctional.js +0 -160
  29. package/test/functional/deprecated/iSqlFunctional.js +0 -453
  30. package/test/functional/deprecated/iUserSpaceFunctional.js +0 -138
  31. package/test/functional/deprecated/iWorkFunctional.js +0 -238
  32. package/test/functional/iDataQueueFunctional.js +0 -83
  33. package/test/functional/iNetworkFunctional.js +0 -131
  34. package/test/functional/iObjFunctional.js +0 -326
  35. package/test/functional/iProdFunctional.js +0 -134
  36. package/test/functional/iSqlFunctional.js +0 -448
  37. package/test/functional/iUserSpaceFunctional.js +0 -134
  38. package/test/functional/iWorkFunctional.js +0 -215
  39. package/test/unit/CommandCallUnit.js +0 -87
  40. package/test/unit/ConnectionUnit.js +0 -188
  41. package/test/unit/ProgamCallUnit.js +0 -281
  42. package/test/unit/deprecated/commandsUnit.js +0 -87
  43. package/test/unit/deprecated/iConnUnit.js +0 -158
  44. package/test/unit/deprecated/iPgmUnit.js +0 -211
  45. package/test/unit/deprecated/iSqlUnit.js +0 -441
  46. package/test/unit/deprecated/xmlToJsonUnit.js +0 -200
package/lib/Deprecated.js CHANGED
@@ -1,31 +1,11 @@
1
- // Copyright (c) International Business Machines Corp. 2019
2
-
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
- // associated documentation files (the "Software"), to deal in the Software without restriction,
5
- // including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
- // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
- // furnished to do so, subject to the following conditions:
8
-
9
- // The above copyright notice and this permission notice shall be included in all copies or
10
- // substantial portions of the Software.
11
-
12
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
- // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
-
18
- // This file contains the classes that are deprecated in v1.0. The implementations for all of the
19
- // functions in these classes prior to v1.0 are moved into the other classes. The classes contained
20
- // in this file are now wrappers for those calls to enable backward compatability with
21
- // previous versions, but will throw a warning message. When we no longer want to support calling
22
- // these methods through these deprecated class names, we can simple disable this file.
1
+ // Copyright contributors to the nodejs-itoolkit project
2
+ // SPDX-License-Identifier: MIT
23
3
 
24
4
  /* eslint-disable max-classes-per-file */
25
5
  /* eslint-disable default-param-last */
26
6
 
27
7
  const deprecate = require('depd');
28
- const { parseString } = require('xml2js');
8
+ const { XMLParser, XMLValidator } = require('fast-xml-parser');
29
9
 
30
10
  const iPgmDeprecate = deprecate('iPgm');
31
11
  const iSqlDeprecate = deprecate('iSql');
@@ -696,26 +676,27 @@ class iDataQueue {
696
676
  cb(null);
697
677
  return;
698
678
  }
699
- parseString(str, (parseError, result) => {
700
- if (parseError) {
701
- if (this.reportError) {
702
- cb(parseError, null);
703
- return;
704
- }
705
- cb(str);
706
- return;
707
- }
708
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
709
- rtValue = true;
710
- } else {
711
- rtValue = str;
712
- }
679
+ const parser = new XMLParser();
680
+ const result = parser.parse(str);
681
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
713
682
  if (this.reportError) {
714
- cb(null, rtValue); // Run the call back function against the returned value.
683
+ cb(Error('Unable to parse the xml input'), null);
715
684
  return;
716
685
  }
717
- cb(rtValue);
718
- });
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);
719
700
  };
720
701
 
721
702
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -758,27 +739,26 @@ class iDataQueue {
758
739
  cb(null);
759
740
  return;
760
741
  }
761
- parseString(str, (parseError, result) => {
762
- if (parseError) {
763
- if (this.reportError) {
764
- cb(parseError, null);
765
- return;
766
- }
767
- cb(str);
768
- return;
769
- }
770
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
771
- rtValue = result.myscript.pgm[0].parm[3].data[0]._;
772
- } else {
773
- rtValue = str;
774
- }
775
-
742
+ const parser = new XMLParser();
743
+ const result = parser.parse(str);
744
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
776
745
  if (this.reportError) {
777
- cb(null, rtValue);
746
+ cb(Error('Unable to parse the xml input'), null);
778
747
  return;
779
748
  }
780
- cb(rtValue);
781
- });
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);
782
762
  };
783
763
  this.conn.run(toJson); // Post the input XML and get the response.
784
764
  }
@@ -815,26 +795,26 @@ class iDataQueue {
815
795
  cb(null);
816
796
  return;
817
797
  }
818
- parseString(str, (parseError, result) => {
819
- if (parseError) {
820
- if (this.reportError) {
821
- cb(parseError, null);
822
- return;
823
- }
824
- cb(str);
825
- return;
826
- }
827
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
828
- rtValue = true;
829
- } else {
830
- rtValue = str;
831
- }
798
+ const parser = new XMLParser();
799
+ const result = parser.parse(str);
800
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
832
801
  if (this.reportError) {
833
- cb(null, rtValue);
802
+ cb(Error('Unable to parse the xml input'), null);
834
803
  return;
835
804
  }
836
- cb(rtValue);
837
- });
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);
838
818
  };
839
819
 
840
820
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -998,56 +978,57 @@ class iNetwork {
998
978
  cb(null);
999
979
  return;
1000
980
  }
1001
- parseString(str, (parseError, result) => {
1002
- if (parseError) {
1003
- if (this.reportError) {
1004
- cb(parseError, null);
1005
- return;
1006
- }
1007
- cb(str);
1008
- return;
1009
- }
1010
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1011
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1012
- rtValue = {
1013
- 'TCP/IPv4_stack_status': data[2]._,
1014
- How_long_active: data[3]._,
1015
- 'When_last_started_-_date': data[4]._,
1016
- 'When_last_started_-_time': data[5]._,
1017
- 'When_last_ended_-_date': data[6]._,
1018
- 'When_last_ended_-_time': data[7]._,
1019
- 'Who_last_started_-_job_name': data[8]._,
1020
- 'Who_last_started_-_job_user_name': data[9]._,
1021
- 'Who_last_started_-_job_number': data[10]._,
1022
- 'Who_last_started_-_internal_job_identifier': data[11]._,
1023
- 'Who_last_ended_-_job_name': data[12]._,
1024
- 'Who_last_ended_-_job_user_name': data[13]._,
1025
- 'Who_last_ended_-_job_number': data[14]._,
1026
- 'Who_last_ended_-_internal_job_identifier': data[14]._,
1027
- Offset_to_additional_information: data[16]._,
1028
- Length_of_additional_information: data[17]._,
1029
- Limited_mode: data[18]._,
1030
- Offset_to_list_of_Internet_addresses: data[19]._,
1031
- Number_of_Internet_addresses: data[20]._,
1032
- Entry_length_for_list_of_Internet_addresses: data[21]._,
1033
- DNS_protocol: data[22]._,
1034
- Retries: data[23]._,
1035
- Time_interval: data[24]._,
1036
- Search_order: data[25]._,
1037
- Initial_domain_name_server: data[26]._,
1038
- DNS_listening_port: data[27]._,
1039
- Host_name: data[28]._,
1040
- Domain_name: data[29]._,
1041
- Domain_search_list: data[31]._,
1042
- };
1043
- } else { rtValue = str; }
1044
-
981
+ const parser = new XMLParser();
982
+ const result = parser.parse(str);
983
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1045
984
  if (this.reportError) {
1046
- cb(null, rtValue);
985
+ cb(Error('Unable to parse the xml input'), null);
1047
986
  return;
1048
987
  }
1049
- cb(rtValue);
1050
- });
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);
1051
1032
  };
1052
1033
  this.conn.run(toJson); // Post the input XML and get the response.
1053
1034
  }
@@ -1228,74 +1209,75 @@ class iNetwork {
1228
1209
  cb(null);
1229
1210
  return;
1230
1211
  }
1231
- parseString(str, (parseError, result) => {
1232
- if (parseError) {
1233
- if (this.reportError) {
1234
- cb(parseError, null);
1235
- return;
1236
- }
1237
- cb(str);
1238
- return;
1239
- }
1240
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1241
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1242
-
1243
- rtValue = {
1244
- Internet_address: data[2]._,
1245
- Internet_address_binary: data[4]._,
1246
- Network_address: data[5]._,
1247
- Network_address_binary: data[7]._,
1248
- Line_description: data[8]._,
1249
- Interface_status: data[10]._,
1250
- Interface_type_of_service: data[11]._,
1251
- Interface_MTU: data[12]._,
1252
- Interface_line_type: data[13]._,
1253
- Host_address: data[14]._,
1254
- Host_address_binary: data[16]._,
1255
- Interface_subnet_mask: data[17]._,
1256
- Interface_subnet_mask_binary: data[19]._,
1257
- Directed_broadcast_address: data[20]._,
1258
- Directed_broadcast_address_binary: data[22]._,
1259
- Change_date: data[23]._,
1260
- Change_time: data[24]._,
1261
- Associated_local_interface: data[25]._,
1262
- Associated_local_interface_binary: data[27]._,
1263
- Change_status: data[28]._,
1264
- Packet_rules: data[29]._,
1265
- Automatic_start: data[30]._,
1266
- TRLAN_bit_sequencing: data[31]._,
1267
- Interface_type: data[32]._,
1268
- Proxy_ARP_allowed: data[33]._,
1269
- Proxy_ARP_enabled: data[34]._,
1270
- Configured_MTU: data[35]._,
1271
- Network_name: data[36]._,
1272
- Interface_name: data[37]._,
1273
- Alias_name: data[38]._,
1274
- Interface_description: data[40]._,
1275
- Offset_to_preferred_interface_list: data[42]._,
1276
- Number_of_entries_in_preferred_interface_list: data[43]._,
1277
- Length_of_one_preferred_interface_list_entry: data[44]._,
1278
- DHCP_created: data[45]._,
1279
- DHCP_dynamic_DNS_updates: data[46]._,
1280
- DHCP_lease_expiration: data[47]._,
1281
- 'DHCP_lease_expiration_-_date': data[48]._,
1282
- 'DHCP_lease_expiration_-_time': data[49]._,
1283
- DHCP_lease_obtained: data[50]._,
1284
- 'DHCP_lease_obtained_-_date': data[51]._,
1285
- 'DHCP_lease_obtained_-_time': data[52]._,
1286
- Use_DHCP_unique_identifier: data[53]._,
1287
- DHCP_server_IP_address: data[54]._,
1288
- Preferred_interface_Internet_address: data[56]._,
1289
- Preferred_interface_Internet_address_binary: data[58]._,
1290
- };
1291
- } else { rtValue = str; }
1292
-
1212
+ const parser = new XMLParser();
1213
+ const result = parser.parse(str);
1214
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1293
1215
  if (this.reportError) {
1294
- cb(null, rtValue);
1216
+ cb(Error('Unable to parse the xml input'), null);
1295
1217
  return;
1296
1218
  }
1297
- cb(rtValue);
1298
- });
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);
1299
1281
  };
1300
1282
  this.conn.run(toJson); // Post the input XML and get the response.
1301
1283
  }
@@ -1387,26 +1369,27 @@ class iObj {
1387
1369
  cb(null);
1388
1370
  return;
1389
1371
  }
1390
- parseString(str, (parseError, result) => {
1391
- if (parseError) {
1392
- if (this.reportError) {
1393
- cb(parseError, null);
1394
- return;
1395
- }
1396
- cb(str);
1397
- return;
1398
- }
1399
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1400
- rtValue = true;
1401
- } else {
1402
- rtValue = str;
1403
- }
1372
+ const parser = new XMLParser();
1373
+ const result = parser.parse(str);
1374
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1404
1375
  if (this.reportError) {
1405
- cb(null, rtValue);
1376
+ cb(Error('Unable to parse the xml input'), null);
1406
1377
  return;
1407
1378
  }
1408
- cb(rtValue);
1409
- });
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);
1410
1393
  };
1411
1394
 
1412
1395
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -1540,59 +1523,61 @@ class iObj {
1540
1523
  cb(null);
1541
1524
  return;
1542
1525
  }
1543
- parseString(str, (parseError, result) => {
1544
- if (parseError) {
1545
- if (this.reportError) {
1546
- cb(parseError, null);
1547
- return;
1548
- }
1549
- cb(str);
1550
- return;
1551
- }
1552
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1553
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1554
-
1555
- rtValue = {
1556
- 'Object_authority_/_Data_authority': data[2]._,
1557
- Authorization_list_management: data[3]._,
1558
- Object_operational: data[4]._,
1559
- Object_management: data[5]._,
1560
- Object_existence: data[6]._,
1561
- Data_read: data[7]._,
1562
- Data_add: data[8]._,
1563
- Data_update: data[9]._,
1564
- Data_delete: data[10]._,
1565
- Authorization_list: data[11]._,
1566
- Authority_source: data[12]._,
1567
- Some_adopted_authority: data[13]._,
1568
- Adopted_object_authority: data[14]._,
1569
- Adopted_authorization_list_management: data[15]._,
1570
- Adopted_object_operational: data[16]._,
1571
- Adopted_object_management: data[17]._,
1572
- Adopted_object_existence: data[18]._,
1573
- Adopted_data_read: data[19]._,
1574
- Adopted_data_add: data[20]._,
1575
- Adopted_data_update: data[21]._,
1576
- Adopted_data_delete: data[22]._,
1577
- Adopted_data_execute: data[23]._,
1578
- Adopted_object_alter: data[25]._,
1579
- Adopted_object_reference: data[26]._,
1580
- Data_execute: data[28]._,
1581
- Object_alter: data[30]._,
1582
- Object_reference: data[31]._,
1583
- ASP_device_name_of_library: data[32]._,
1584
- ASP_device_name_of_object: data[33]._,
1585
- Offset_to_group_information_table: data[35]._,
1586
- Number_of_group_table_entries_returned: data[36]._,
1587
- };
1588
- } else { rtValue = str; }
1589
-
1526
+ const parser = new XMLParser();
1527
+ const result = parser.parse(str);
1528
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1590
1529
  if (this.reportError) {
1591
- cb(null, rtValue);
1530
+ cb(Error('Unable to parse the xml input'), null);
1592
1531
  return;
1593
1532
  }
1594
- cb(rtValue);
1595
- });
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);
1596
1581
  };
1597
1582
 
1598
1583
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -1736,69 +1721,68 @@ class iObj {
1736
1721
  return;
1737
1722
  }
1738
1723
 
1739
- parseString(str, (parseError, result) => {
1740
- if (parseError) {
1741
- if (this.reportError) {
1742
- cb(parseError, null);
1743
- return;
1744
- }
1745
- cb(str);
1746
- return;
1747
- }
1748
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1749
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1750
-
1751
- rtValue = {
1752
- Command_name: data[2]._,
1753
- Command_library_name: data[3]._,
1754
- Command_processing_program_or_proxy_target_command: data[4]._,
1755
- "Command_processing_program's_or_proxy_target_command's_library_name": data[5]._,
1756
- Source_file_name: data[6]._,
1757
- Source_file_library_name: data[7]._,
1758
- Source_file_member_name: data[8]._,
1759
- Validity_check_program_name: data[9]._,
1760
- Validity_check_program_library_name: data[10]._,
1761
- Mode_information: data[11]._,
1762
- Where_allowed_to_run: data[12]._,
1763
- Allow_limited_user: data[13]._,
1764
- Maximum_positional_parameters: data[14]._,
1765
- Prompt_message_file_name: data[15]._,
1766
- Prompt_message_file_library_name: data[16]._,
1767
- Message_file_name: data[17]._,
1768
- Message_file_library_name: data[18]._,
1769
- Help_panel_group_name: data[19]._,
1770
- Help_panel_group_library_name: data[20]._,
1771
- Help_identifier: data[21]._,
1772
- Search_index_name: data[22]._,
1773
- Search_index_library_name: data[23]._,
1774
- Current_library: data[24]._,
1775
- Product_library: data[25]._,
1776
- Prompt_override_program_name: data[26]._,
1777
- Prompt_override_program_library_name: data[27]._,
1778
- Restricted_to_target_release: data[28]._,
1779
- Text_description: data[29]._,
1780
- Command_processing_program_call_state: data[30]._,
1781
- Validity_check_program_call_state: data[31]._,
1782
- Prompt_override_program_call_state: data[32]._,
1783
- Offset_to_help_bookshelf_information: data[33]._,
1784
- Length_of_help_bookshelf_information: data[34]._,
1785
- 'Coded_character_set_ID_(CCSID)': data[35]._,
1786
- Enabled_for_GUI_indicator: data[36]._,
1787
- Threadsafe_indicator: data[37]._,
1788
- Multithreaded_job_action: data[38]._,
1789
- Proxy_command_indicator: data[39]._,
1790
- Prompt_message_file_text_indicator: data[40]._,
1791
- };
1792
- } else { rtValue = str; }
1793
-
1724
+ const parser = new XMLParser();
1725
+ const result = parser.parse(str);
1726
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
1794
1727
  if (this.reportError) {
1795
- cb(null, rtValue);
1728
+ cb(Error('Unable to parse the xml input'), null);
1796
1729
  return;
1797
1730
  }
1798
- cb(rtValue);
1799
- });
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);
1800
1785
  };
1801
-
1802
1786
  this.conn.run(toJson); // Post the input XML and get the response.
1803
1787
  }
1804
1788
 
@@ -1985,88 +1969,89 @@ class iObj {
1985
1969
  cb(null);
1986
1970
  return;
1987
1971
  }
1988
- parseString(str, (parseError, result) => {
1989
- if (parseError) {
1990
- if (this.reportError) {
1991
- cb(parseError, null);
1992
- return;
1993
- }
1994
- cb(str);
1995
- return;
1996
- }
1997
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
1998
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
1999
- rtValue = {
2000
- Program_name: data[2]._,
2001
- Program_library_name: data[3]._,
2002
- Program_owner: data[4]._,
2003
- Program_attribute: data[5]._,
2004
- Creation_date_and_time: data[6]._,
2005
- Source_file_name: data[7]._,
2006
- Source_file_library_name: data[8]._,
2007
- Source_file_member_name: data[9]._,
2008
- Source_file_updated_date_and_time: data[10]._,
2009
- Observable_information: data[11]._,
2010
- User_profile_option: data[12]._,
2011
- Use_adopted_authority: data[13]._,
2012
- Log_commands: data[14]._,
2013
- Allow_RTVCLSRC: data[15]._,
2014
- Fix_decimal_data: data[16]._,
2015
- Text_description: data[17]._,
2016
- Type_of_program: data[18]._,
2017
- 'Teraspace_storage-enabled_program': data[19]._,
2018
- Minimum_number_of_parameters: data[21]._,
2019
- Maximum_number_of_parameters: data[22]._,
2020
- Program_size: data[23]._,
2021
- Associated_space_size: data[24]._,
2022
- Static_storage_size: data[25]._,
2023
- Automatic_storage_size: data[26]._,
2024
- Number_of_MI_instructions: data[27]._,
2025
- Number_of_MI_ODT_entries: data[28]._,
2026
- Program_state: data[29]._,
2027
- Compiler_identification: data[30]._,
2028
- Earliest_release_program_can_run: data[31]._,
2029
- Sort_sequence_table_name: data[32]._,
2030
- Sort_sequence_table_library_name: data[33]._,
2031
- Language_identifier: data[34]._,
2032
- Program_domain: data[35]._,
2033
- Conversion_required: data[36]._,
2034
- Conversion_details: data[37]._,
2035
- Optimization: data[39]._,
2036
- Paging_pool: data[40]._,
2037
- 'Update_program_automatic_storage_area_(PASA)': data[41]._,
2038
- 'Clear_program_automatic_storage_area_(PASA)': data[42]._,
2039
- Paging_amount: data[43]._,
2040
- Program_entry_procedure_module: data[45]._,
2041
- Program_entry_procedure_module_library: data[46]._,
2042
- Activation_group_attribute: data[47]._,
2043
- Observable_information_compressed: data[48]._,
2044
- 'Run-time_information_compressed': data[49]._,
2045
- Release_program_created_on: data[50]._,
2046
- Shared_activation_group: data[51]._,
2047
- Allow_update: data[52]._,
2048
- Program_CCSID: data[53]._,
2049
- Number_of_modules: data[54]._,
2050
- Number_of_service_programs: data[55]._,
2051
- Number_of_copyrights: data[56]._,
2052
- Number_of_unresolved_references: data[57]._,
2053
- Release_program_created_for: data[58]._,
2054
- Allow_static_storage_reinitialization: data[59]._,
2055
- All_creation_data: data[60]._,
2056
- 'Allow_bound_*SRVPGM_library_name_update': data[61]._,
2057
- Profiling_data: data[62]._,
2058
- Teraspace_storage_enabled_modules: data[63]._,
2059
- Storage_model: data[64]._,
2060
- 'Uses_argument_optimization_(ARGOPT)': data[65]._,
2061
- };
2062
- } else { rtValue = str; }
2063
-
1972
+ const parser = new XMLParser();
1973
+ const result = parser.parse(str);
1974
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2064
1975
  if (this.reportError) {
2065
- cb(null, rtValue);
1976
+ cb(Error('Unable to parse the xml input'), null);
2066
1977
  return;
2067
1978
  }
2068
- cb(rtValue);
2069
- });
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);
2070
2055
  };
2071
2056
 
2072
2057
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2213,69 +2198,69 @@ class iObj {
2213
2198
  cb(null);
2214
2199
  return;
2215
2200
  }
2216
- parseString(str, (parseError, result) => {
2217
- if (parseError) {
2218
- if (this.reportError) {
2219
- cb(parseError, null);
2220
- return;
2221
- }
2222
- cb(str);
2223
- return;
2224
- }
2225
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2226
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2227
-
2228
- rtValue = {
2229
- Service_program_name: data[2]._,
2230
- Service_program_library_name: data[3]._,
2231
- Service_program_owner: data[4]._,
2232
- Service_program_attribute: data[5]._,
2233
- Creation_date_and_time: data[6]._,
2234
- Export_source_file_name: data[7]._,
2235
- Export_source_file_library_name: data[8]._,
2236
- Export_source_file_member_name: data[9]._,
2237
- Activation_group_attribute: data[10]._,
2238
- Current_export_signature: data[11]._,
2239
- User_profile: data[12]._,
2240
- Observable_information_compressed: data[13]._,
2241
- 'Run-time_information_compressed': data[14]._,
2242
- Service_program_CCSID: data[15]._,
2243
- Number_of_modules: data[16]._,
2244
- Number_of_service_programs: data[17]._,
2245
- Number_of_copyrights: data[18]._,
2246
- Text_description: data[19]._,
2247
- Shared_activation_group: data[20]._,
2248
- Allow_update: data[21]._,
2249
- Number_of_unresolved_references: data[22]._,
2250
- Use_adopted_authority: data[23]._,
2251
- 'Allow_bound_*SRVPGM_library_name_update': data[24]._,
2252
- Profiling_data: data[25]._,
2253
- Teraspace_storage_enabled_modules: data[26]._,
2254
- Storage_model: data[27]._,
2255
- 'Uses_argument_optimization_(ARGOPT)': data[28]._,
2256
- Service_program_state: data[30]._,
2257
- Service_program_domain: data[31]._,
2258
- Associated_space_size: data[32]._,
2259
- Static_storage_size: data[33]._,
2260
- Service_program_size: data[34]._,
2261
- Release_service_program_created_on: data[35]._,
2262
- Earliest_release_service_program_can_run: data[36]._,
2263
- Release_service_program_created_for: data[37]._,
2264
- Allow_static_storage_reinitialization: data[38]._,
2265
- Conversion_required: data[39]._,
2266
- All_creation_data: data[40]._,
2267
- Conversion_details: data[41]._,
2268
- Paging_pool: data[43]._,
2269
- Paging_amount: data[44]._,
2270
- };
2271
- } else { rtValue = str; }
2272
-
2201
+ const parser = new XMLParser();
2202
+ const result = parser.parse(str);
2203
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2273
2204
  if (this.reportError) {
2274
- cb(null, rtValue);
2205
+ cb(Error('Unable to parse the xml input'), null);
2275
2206
  return;
2276
2207
  }
2277
- cb(rtValue);
2278
- });
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);
2279
2264
  };
2280
2265
 
2281
2266
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2358,40 +2343,41 @@ class iObj {
2358
2343
  cb(null);
2359
2344
  return;
2360
2345
  }
2361
- parseString(str, (parseError, result) => {
2362
- if (parseError) {
2363
- if (this.reportError) {
2364
- cb(parseError, null);
2365
- return;
2366
- }
2367
- cb(str);
2368
- return;
2369
- }
2370
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2371
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2372
- rtValue = {
2373
- User_profile_name: data[2]._,
2374
- 'Previous_sign-on_date_and_time': data[3]._,
2375
- 'Sign-on_attempts_not_valid': data[5]._,
2376
- Status: data[6]._,
2377
- Password_change_date: data[7]._,
2378
- No_password_indicator: data[8]._,
2379
- Password_expiration_interval: data[10]._,
2380
- Date_password_expires: data[11]._,
2381
- Days_until_password_expires: data[12]._,
2382
- Set_password_to_expire: data[13]._,
2383
- 'Display_sign-on_information': data[14]._,
2384
- Local_password_management: data[15]._,
2385
- Block_password_change: data[16]._,
2386
- };
2387
- } else { rtValue = str; }
2388
-
2346
+ const parser = new XMLParser();
2347
+ const result = parser.parse(str);
2348
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2389
2349
  if (this.reportError) {
2390
- cb(null, rtValue);
2350
+ cb(Error('Unable to parse the xml input'), null);
2391
2351
  return;
2392
2352
  }
2393
- cb(rtValue);
2394
- });
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);
2395
2381
  };
2396
2382
 
2397
2383
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2495,41 +2481,42 @@ class iObj {
2495
2481
  cb(null);
2496
2482
  return;
2497
2483
  }
2498
- parseString(str, (parseError, result) => {
2499
- if (parseError) {
2500
- if (this.reportError) {
2501
- cb(parseError, null);
2502
- return;
2503
- }
2504
- cb(str);
2505
- return;
2506
- }
2507
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2508
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2509
- rtValue = {
2510
- Profile_name: data[0]._,
2511
- User_or_group_indicator: data[1]._,
2512
- Data_authority: data[2]._,
2513
- Authorization_list_management: data[3]._,
2514
- Object_management: data[4]._,
2515
- Object_existence: data[5]._,
2516
- Object_alter: data[6]._,
2517
- Object_reference: data[7]._,
2518
- Object_operational: data[9]._,
2519
- Data_read: data[10]._,
2520
- Data_add: data[11]._,
2521
- Data_update: data[12]._,
2522
- Data_delete: data[13]._,
2523
- Data_execute: data[14]._,
2524
- };
2525
- } else { rtValue = str; }
2526
-
2484
+ const parser = new XMLParser();
2485
+ const result = parser.parse(str);
2486
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2527
2487
  if (this.reportError) {
2528
- cb(null, rtValue);
2488
+ cb(Error('Unable to parse the xml input'), null);
2529
2489
  return;
2530
2490
  }
2531
- cb(rtValue);
2532
- });
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);
2533
2520
  };
2534
2521
 
2535
2522
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2710,56 +2697,57 @@ class iProd {
2710
2697
  cb(null);
2711
2698
  return;
2712
2699
  }
2713
- parseString(str, (parseError, result) => {
2714
- if (parseError) {
2715
- if (this.reportError) {
2716
- cb(parseError, null);
2717
- return;
2718
- }
2719
- cb(null);
2720
- return;
2721
- }
2722
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2723
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2724
- rtValue = {
2725
- Product_ID: data[3]._,
2726
- PTF_ID: data[4]._,
2727
- Release_level: data[5]._,
2728
- Product_option: data[6]._,
2729
- Load_ID: data[7]._,
2730
- Loaded_status: data[8]._,
2731
- Cover_letter_status: data[9]._,
2732
- 'On-order_status': data[10]._,
2733
- Save_file_status: data[11]._,
2734
- File_name: data[12]._,
2735
- File_library_name: data[13]._,
2736
- PTF_type: data[14]._,
2737
- IPL_action: data[15]._,
2738
- Action_pending: data[16]._,
2739
- Action_required: data[17]._,
2740
- PTF_is_released: data[18]._,
2741
- Target_release: data[19]._,
2742
- Superseding_PTF: data[20]._,
2743
- Current_IPL_source: data[21]._,
2744
- Minimum_level: data[22]._,
2745
- Maximum_level: data[23]._,
2746
- Format_information_available: data[24]._,
2747
- Status_date_and_time: data[25]._,
2748
- Licensed_Internal_Code_group: data[26]._,
2749
- Superseded_by_PTF_ID: data[27]._,
2750
- Current_server_IPL_source: data[28]._,
2751
- Server_IPL_required: data[29]._,
2752
- Creation_date_and_time: data[30]._,
2753
- Technology_refresh_PTF: data[31]._,
2754
- };
2755
- } else { rtValue = str; }
2756
-
2700
+ const parser = new XMLParser();
2701
+ const result = parser.parse(str);
2702
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2757
2703
  if (this.reportError) {
2758
- cb(null, rtValue);
2704
+ cb(Error('Unable to parse the xml input'), null);
2759
2705
  return;
2760
2706
  }
2761
- cb(rtValue);
2762
- });
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);
2763
2751
  };
2764
2752
 
2765
2753
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -2885,45 +2873,45 @@ class iProd {
2885
2873
  callback(null);
2886
2874
  return;
2887
2875
  }
2888
- parseString(str, (parseError, result) => {
2889
- if (parseError) {
2890
- if (this.reportError) {
2891
- callback(parseError, null);
2892
- return;
2893
- }
2894
- callback(null);
2895
- return;
2896
- }
2897
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
2898
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
2899
-
2900
- rtValue = {
2901
- Product_ID: data[3]._,
2902
- Release_level: data[4]._,
2903
- Product_option: data[5]._,
2904
- Load_ID: data[6]._,
2905
- Load_type: data[7]._,
2906
- Symbolic_load_state: data[8]._,
2907
- Load_error_indicator: data[9]._,
2908
- Load_state: data[10]._,
2909
- Supported_flag: data[11]._,
2910
- Registration_type: data[12]._,
2911
- Registration_value: data[13]._,
2912
- Offset_to_additional_information: data[15]._,
2913
- Primary_language_load_identifier: data[16]._,
2914
- Minimum_target_release: data[17]._,
2915
- 'Minimum_VRM_of_*BASE_required_by_option': data[18]._,
2916
- Requirements_met_between_base_and_option_value: data[19]._,
2917
- Level: data[20]._,
2918
- };
2919
- } else { rtValue = str; }
2920
-
2876
+ const parser = new XMLParser();
2877
+ const result = parser.parse(str);
2878
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
2921
2879
  if (this.reportError) {
2922
- callback(null, rtValue);
2880
+ cb(Error('Unable to parse the xml input'), null);
2923
2881
  return;
2924
2882
  }
2925
- callback(rtValue);
2926
- });
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);
2927
2915
  };
2928
2916
 
2929
2917
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3029,42 +3017,42 @@ class iProd {
3029
3017
  cb(null);
3030
3018
  return;
3031
3019
  }
3032
- parseString(str, (parseError, result) => {
3033
- if (parseError) {
3034
- if (this.reportError) {
3035
- cb(parseError, null);
3036
- return;
3037
- }
3038
- cb(str);
3039
- return;
3040
- }
3041
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3042
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3043
- const count = result.myscript.pgm[0].parm[4].ds[0].data[1]._;
3044
-
3045
- for (let i = 0; i < count * 12; i += 12) {
3046
- rtValue.push({
3047
- Product_ID: data[i]._,
3048
- Product_option: data[i + 1]._,
3049
- Release_level: data[i + 2]._,
3050
- Description_text_message_ID: data[i + 4]._,
3051
- Description_text_object_name: data[i + 5]._,
3052
- Description_text_library_name: data[i + 6]._,
3053
- Installed_flag: data[i + 7]._,
3054
- Supported_flag: data[i + 8]._,
3055
- Registration_type: data[i + 9]._,
3056
- Registration_value: data[i + 10]._,
3057
- Description_text: data[i + 11]._,
3058
- });
3059
- }
3060
- } else { rtValue = str; }
3061
-
3020
+ const parser = new XMLParser();
3021
+ const result = parser.parse(str);
3022
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3062
3023
  if (this.reportError) {
3063
- cb(null, rtValue);
3024
+ cb(Error('Unable to parse the xml input'), null);
3064
3025
  return;
3065
3026
  }
3066
- cb(rtValue);
3067
- });
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);
3068
3056
  };
3069
3057
 
3070
3058
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3167,27 +3155,26 @@ class iUserSpace {
3167
3155
  cb(null);
3168
3156
  return;
3169
3157
  }
3170
- parseString(str, (parseError, result) => {
3171
- if (parseError) {
3172
- if (this.reportError) {
3173
- cb(parseError, null);
3174
- return;
3175
- }
3176
- cb(str);
3177
- return;
3178
- }
3179
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3180
- rtValue = true;
3181
- } else {
3182
- rtValue = str;
3183
- }
3184
-
3158
+ const parser = new XMLParser();
3159
+ const result = parser.parse(str);
3160
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3185
3161
  if (this.reportError) {
3186
- cb(null, rtValue);
3162
+ cb(Error('Unable to parse the xml input'), null);
3187
3163
  return;
3188
3164
  }
3189
- cb(rtValue);
3190
- });
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);
3191
3178
  };
3192
3179
 
3193
3180
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3239,26 +3226,26 @@ class iUserSpace {
3239
3226
  cb(null);
3240
3227
  return;
3241
3228
  }
3242
- parseString(str, (parseError, result) => {
3243
- if (parseError) {
3244
- if (this.reportError) {
3245
- cb(parseError, null);
3246
- return;
3247
- }
3248
- cb(str);
3249
- return;
3250
- }
3251
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3252
- rtValue = true;
3253
- } else {
3254
- rtValue = str;
3255
- }
3229
+ const parser = new XMLParser();
3230
+ const result = parser.parse(str);
3231
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3256
3232
  if (this.reportError) {
3257
- cb(null, rtValue);
3233
+ cb(Error('Unable to parse the xml input'), null);
3258
3234
  return;
3259
3235
  }
3260
- cb(rtValue);
3261
- });
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);
3262
3249
  };
3263
3250
 
3264
3251
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3309,27 +3296,27 @@ class iUserSpace {
3309
3296
  cb(null);
3310
3297
  return;
3311
3298
  }
3312
- parseString(str, (parseError, result) => {
3313
- if (parseError) {
3314
- if (this.reportError) {
3315
- cb(parseError, null);
3316
- return;
3317
- }
3318
- cb(str);
3319
- return;
3320
- }
3321
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3322
- const { data } = result.myscript.pgm[0].parm[3];
3323
- rtValue = data[0]._;
3324
- } else {
3325
- rtValue = str;
3326
- }
3299
+ const parser = new XMLParser();
3300
+ const result = parser.parse(str);
3301
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3327
3302
  if (this.reportError) {
3328
- cb(null, rtValue);
3303
+ cb(Error('Unable to parse the xml input'), null);
3329
3304
  return;
3330
3305
  }
3331
- cb(rtValue);
3332
- });
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);
3333
3320
  };
3334
3321
 
3335
3322
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3375,25 +3362,27 @@ class iUserSpace {
3375
3362
  cb(null);
3376
3363
  return;
3377
3364
  }
3378
- parseString(str, (parseError, result) => {
3379
- if (parseError) {
3380
- if (this.reportError) {
3381
- cb(parseError, null);
3382
- return;
3383
- }
3384
- cb(str);
3385
- return;
3386
- }
3387
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3388
- rtValue = true;
3389
- } else { rtValue = str; }
3390
3365
 
3366
+ const parser = new XMLParser();
3367
+ const result = parser.parse(str);
3368
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3391
3369
  if (this.reportError) {
3392
- cb(null, rtValue);
3370
+ cb(Error('Unable to parse the xml input'), null);
3393
3371
  return;
3394
3372
  }
3395
- cb(rtValue);
3396
- });
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);
3397
3386
  };
3398
3387
 
3399
3388
  this.conn.run(toJson); // Post the input XML and get the response.
@@ -3552,27 +3541,28 @@ class iWork {
3552
3541
  cb(null);
3553
3542
  return;
3554
3543
  }
3555
- parseString(str, (parseError, result) => {
3556
- if (parseError) {
3557
- if (this.reportError) {
3558
- cb(parseError, null);
3559
- return;
3560
- }
3561
- cb(str);
3562
- return;
3563
- }
3564
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3565
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3566
- rtValue = data[6]._; // Get the returned value from the output array.
3567
- } else {
3568
- rtValue = str;
3569
- }
3544
+ const parser = new XMLParser();
3545
+ const result = parser.parse(str);
3546
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3570
3547
  if (this.reportError) {
3571
- cb(null, rtValue);
3548
+ cb(Error('Unable to parse the xml input'), null);
3572
3549
  return;
3573
3550
  }
3574
- cb(rtValue);
3575
- });
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);
3576
3566
  };
3577
3567
 
3578
3568
  this.conn.run(toJson); // Post the input XML
@@ -3658,43 +3648,46 @@ class iWork {
3658
3648
  cb(null);
3659
3649
  return;
3660
3650
  }
3661
- parseString(str, (parseError, result) => {
3662
- if (parseError) {
3663
- if (this.reportError) {
3664
- cb(parseError, null);
3665
- return;
3666
- }
3667
- cb(str);
3668
- return;
3669
- }
3670
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3671
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3672
- rtValue = {
3673
- Current_date_and_time: data[2]._,
3674
- System_name: data[3]._,
3675
- Users_currently_signed_on: data[4]._,
3676
- 'Users_temporarily_signed_off_(disconnected)': data[5]._,
3677
- Users_suspended_by_system_request: data[6]._,
3678
- Users_suspended_by_group_jobs: data[7]._,
3679
- Users_signed_off_with_printer_output_waiting_to_print: data[8]._,
3680
- Batch_jobs_waiting_for_messages: data[9]._,
3681
- Batch_jobs_running: data[10]._,
3682
- Batch_jobs_held_while_running: data[11]._,
3683
- Batch_jobs_ending: data[12]._,
3684
- Batch_jobs_waiting_to_run_or_already_scheduled: data[13]._,
3685
- Batch_jobs_held_on_a_job_queue: data[14]._,
3686
- Batch_jobs_on_a_held_job_queue: data[15]._,
3687
- Batch_jobs_on_an_unassigned_job_queue: data[16]._,
3688
- Batch_jobs_ended_with_printer_output_waiting_to_print: data[17]._,
3689
- };
3690
- } else { rtValue = str; }
3691
3651
 
3652
+ const parser = new XMLParser();
3653
+ const result = parser.parse(str);
3654
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3692
3655
  if (this.reportError) {
3693
- cb(null, rtValue);
3656
+ cb(Error('Unable to parse the xml input'), null);
3694
3657
  return;
3695
3658
  }
3696
- cb(rtValue);
3697
- });
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);
3698
3691
  };
3699
3692
 
3700
3693
  this.conn.run(toJson);
@@ -3813,59 +3806,60 @@ class iWork {
3813
3806
  cb(null);
3814
3807
  return;
3815
3808
  }
3816
- parseString(str, (parseError, result) => {
3817
- if (parseError) {
3818
- if (this.reportError) {
3819
- cb(parseError, null);
3820
- return;
3821
- }
3822
- cb(str);
3823
- return;
3824
- }
3825
-
3826
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3827
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3828
- rtValue = {
3829
- Current_date_and_time: data[2]._,
3830
- System_name: data[3]._,
3831
- Elapsed_time: data[4]._,
3832
- Restricted_state_flag: data[5]._,
3833
- '%_processing_unit_used': data[7]._,
3834
- Jobs_in_system: data[8]._,
3835
- '%_permanent_addresses': data[9]._,
3836
- '%_temporary_addresses': data[10]._,
3837
- System_ASP: data[11]._,
3838
- '%_system_ASP_used': data[12]._,
3839
- Total_auxiliary_storage: data[13]._,
3840
- Current_unprotected_storage_used: data[14]._,
3841
- Maximum_unprotected_storage_used: data[15]._,
3842
- '%_DB_capability': data[16]._,
3843
- Main_storage_size: data[17]._,
3844
- Number_of_partitions: data[18]._,
3845
- Partition_identifier: data[19]._,
3846
- Current_processing_capacity: data[21]._,
3847
- Processor_sharing_attribute: data[22]._,
3848
- Number_of_processors: data[24]._,
3849
- Active_jobs_in_system: data[25]._,
3850
- Active_threads_in_system: data[26]._,
3851
- Maximum_jobs_in_system: data[27]._,
3852
- '%_temporary_256MB_segments_used': data[28]._,
3853
- '%_temporary_4GB_segments_used': data[29]._,
3854
- '%_permanent_256MB_segments_used': data[30]._,
3855
- '%_permanent_4GB_segments_used': data[31]._,
3856
- '%_current_interactive_performance': data[32]._,
3857
- '%_uncapped_CPU_capacity_used': data[33]._,
3858
- '%_shared_processor_pool_used': data[34]._,
3859
- 'Main_storage_size_(long)': data[35]._,
3860
- };
3861
- } else { rtValue = str; }
3862
3809
 
3810
+ const parser = new XMLParser();
3811
+ const result = parser.parse(str);
3812
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3863
3813
  if (this.reportError) {
3864
- cb(null, rtValue);
3814
+ cb(Error('Unable to parse the xml input'), null);
3865
3815
  return;
3866
3816
  }
3867
- cb(rtValue);
3868
- });
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);
3869
3863
  };
3870
3864
 
3871
3865
  this.conn.run(toJson);
@@ -3926,30 +3920,31 @@ class iWork {
3926
3920
  cb(null);
3927
3921
  return;
3928
3922
  }
3929
- parseString(str, (parseError, result) => {
3930
- if (parseError) {
3931
- if (this.reportError) {
3932
- cb(parseError, null);
3933
- return;
3934
- }
3935
- cb(str);
3936
- return;
3937
- }
3938
-
3939
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
3940
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
3941
- rtValue = {
3942
- Job_status: data[2]._,
3943
- Fully_qualified_job_name: data[4]._,
3944
- };
3945
- } else { rtValue = str; }
3946
3923
 
3924
+ const parser = new XMLParser();
3925
+ const result = parser.parse(str);
3926
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
3947
3927
  if (this.reportError) {
3948
- cb(null, rtValue);
3928
+ cb(Error('Unable to parse the xml input'), null);
3949
3929
  return;
3950
3930
  }
3951
- cb(rtValue);
3952
- });
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);
3953
3948
  };
3954
3949
 
3955
3950
  this.conn.run(toJson);
@@ -4088,64 +4083,64 @@ class iWork {
4088
4083
  cb(null);
4089
4084
  return;
4090
4085
  }
4091
- parseString(str, (parseError, result) => {
4092
- if (parseError) {
4093
- if (this.reportError) {
4094
- cb(parseError, null);
4095
- return;
4096
- }
4097
- cb(str);
4098
- return;
4099
- }
4100
-
4101
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
4102
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
4103
-
4104
- rtValue = {
4105
- Job_name: data[2]._,
4106
- User_name: data[3]._,
4107
- Job_number: data[4]._,
4108
- Job_status: data[6]._,
4109
- Job_type: data[7]._,
4110
- Job_subtype: data[8]._,
4111
- Subsystem_description_name: data[9]._,
4112
- 'Run_priority_(job)': data[10]._,
4113
- System_pool_identifier: data[11]._,
4114
- 'Processing_unit_time_used,_if_less_than_2,147,483,647_milliseconds': data[12]._,
4115
- 'Number_of_auxiliary_I/O_requests,_if_less_than_2,147,483,647': data[13]._,
4116
- Number_of_interactive_transactions: data[14]._,
4117
- Response_time_total: data[15]._,
4118
- Function_type: data[16]._,
4119
- Function_name: data[17]._,
4120
- Active_job_status: data[18]._,
4121
- Number_of_database_lock_waits: data[19]._,
4122
- Number_of_internal_machine_lock_waits: data[20]._,
4123
- Number_of_nondatabase_lock_waits: data[21]._,
4124
- Time_spent_on_database_lock_waits: data[22]._,
4125
- Time_spent_on_internal_machine_lock_waits: data[23]._,
4126
- Time_spent_on_nondatabase_lock_waits: data[24]._,
4127
- Current_system_pool_identifier: data[26]._,
4128
- Thread_count: data[27]._,
4129
- 'Processing_unit_time_used_-_total_for_the_job': data[28]._,
4130
- 'Number_of_auxiliary_I/O_requests': data[29]._,
4131
- 'Processing_unit_time_used_for_database_-_total_for_the_job': data[30]._,
4132
- Page_faults: data[31]._,
4133
- Active_job_status_for_jobs_ending: data[32]._,
4134
- Memory_pool_name: data[33]._,
4135
- Message_reply: data[34]._,
4136
- 'Message_key,_when_active_job_waiting_for_a_message': data[35]._,
4137
- 'Message_queue_name,_when_active_job_waiting_for_a_message': data[36]._,
4138
- 'Message_queue_library_name,_when_active_job_waiting_for_a_message': data[37]._,
4139
- 'Message_queue_library_ASP_device_name,_when_active_job_waiting_for_a_message': data[38]._,
4140
- };
4141
- } else { rtValue = str; }
4142
4086
 
4087
+ const parser = new XMLParser();
4088
+ const result = parser.parse(str);
4089
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
4143
4090
  if (this.reportError) {
4144
- cb(null, rtValue);
4091
+ cb(Error('Unable to parse the xml input'), null);
4145
4092
  return;
4146
4093
  }
4147
- cb(rtValue);
4148
- });
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);
4149
4144
  };
4150
4145
  this.conn.run(toJson);
4151
4146
  }
@@ -4219,32 +4214,34 @@ class iWork {
4219
4214
  cb(null);
4220
4215
  return;
4221
4216
  }
4222
- parseString(str, (parseError, result) => {
4223
- if (parseError) {
4224
- if (this.reportError) {
4225
- cb(parseError, null);
4226
- return;
4227
- }
4228
- cb(str);
4229
- return;
4230
- }
4231
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
4232
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
4233
- rtValue = {
4234
- Type_of_value_returned: data[2]._,
4235
- Library_name: data[3]._,
4236
- Length_of_value_returned: data[4]._,
4237
- Number_of_decimal_positions: data[5]._,
4238
- Value: data[6]._,
4239
- };
4240
- } else { rtValue = str; }
4241
4217
 
4218
+ const parser = new XMLParser();
4219
+ const result = parser.parse(str);
4220
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
4242
4221
  if (this.reportError) {
4243
- cb(null, rtValue);
4222
+ cb(Error('Unable to parse the xml input'), null);
4244
4223
  return;
4245
4224
  }
4246
- cb(rtValue);
4247
- });
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);
4248
4245
  };
4249
4246
  this.conn.run(toJson);
4250
4247
  }