xml-toolkit 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/XMLMarshaller.js +2 -2
- package/package.json +1 -1
- package/test/test.js +20 -8
package/lib/XMLMarshaller.js
CHANGED
|
@@ -32,7 +32,7 @@ const XML_DECL = [
|
|
|
32
32
|
|
|
33
33
|
const _declaration = o => {
|
|
34
34
|
|
|
35
|
-
if (typeof o !== 'object' || o === null) return
|
|
35
|
+
if (typeof o !== 'object' || o === null) return ''
|
|
36
36
|
|
|
37
37
|
let s = '<?xml'
|
|
38
38
|
|
|
@@ -247,7 +247,7 @@ const XMLMarshaller = class {
|
|
|
247
247
|
|
|
248
248
|
case 'simpleType':
|
|
249
249
|
|
|
250
|
-
if (data !== null && typeof data === 'object') data = data [null]
|
|
250
|
+
if (data !== null && typeof data === 'object' && !(data instanceof Date)) data = data [null]
|
|
251
251
|
|
|
252
252
|
if (data != null) this.appendScalar (node, data)
|
|
253
253
|
|
package/package.json
CHANGED
package/test/test.js
CHANGED
|
@@ -392,12 +392,24 @@ async function test_009_schemata (fn) {
|
|
|
392
392
|
|
|
393
393
|
// console.log (xs.stringify ({AckResponse: null}))
|
|
394
394
|
|
|
395
|
+
/*
|
|
395
396
|
const data = {
|
|
396
397
|
AckRequest: {
|
|
397
398
|
// AckTargetMessage: {Id: 1, accepted: true, null: 2},
|
|
398
399
|
AckTargetMessage: 11111,
|
|
399
400
|
}
|
|
400
401
|
}
|
|
402
|
+
*/
|
|
403
|
+
|
|
404
|
+
const data = {GetResponseRequest: {
|
|
405
|
+
|
|
406
|
+
MessageTypeSelector: {
|
|
407
|
+
Id: 1,
|
|
408
|
+
Timestamp: new Date ()//.toJSON ()
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
}}
|
|
412
|
+
|
|
401
413
|
|
|
402
414
|
console.log (xs.stringify (data))
|
|
403
415
|
|
|
@@ -476,8 +488,8 @@ function test_013_soap () {
|
|
|
476
488
|
detail
|
|
477
489
|
})
|
|
478
490
|
|
|
479
|
-
console.log (SOAP (1.1).message (f))
|
|
480
|
-
console.log (SOAP (1.2).message (f))
|
|
491
|
+
console.log (SOAP (1.1).message (f, '', {declaration: {}}))
|
|
492
|
+
// console.log (SOAP (1.2).message (f))
|
|
481
493
|
|
|
482
494
|
}
|
|
483
495
|
|
|
@@ -497,11 +509,11 @@ async function main () {
|
|
|
497
509
|
// await test_003_emitter_sync ('ent.xml')
|
|
498
510
|
// await test_003_emitter_sync ('soap.xml')
|
|
499
511
|
|
|
500
|
-
await test_004_schemata ()
|
|
501
|
-
await test_005_schemata ()
|
|
502
|
-
await test_006_schemata ()
|
|
503
|
-
test_007_wsdl ()
|
|
504
|
-
await test_008_schemata ()
|
|
512
|
+
// await test_004_schemata ()
|
|
513
|
+
// await test_005_schemata ()
|
|
514
|
+
// await test_006_schemata ()
|
|
515
|
+
// test_007_wsdl ()
|
|
516
|
+
// await test_008_schemata ()
|
|
505
517
|
|
|
506
518
|
test_009_schemata ('smev-message-exchange-service-1.1.xsd')
|
|
507
519
|
// test_009_schemata ('sign.xsd')
|
|
@@ -513,7 +525,7 @@ async function main () {
|
|
|
513
525
|
// test_012_parser ('param_types.xml')
|
|
514
526
|
// test_012_parser ('20040.wsdl')
|
|
515
527
|
|
|
516
|
-
test_013_soap ()
|
|
528
|
+
//test_013_soap ()
|
|
517
529
|
|
|
518
530
|
}
|
|
519
531
|
|