From 26af0bd2d82f5318156d2096754c0353b5cbd5c3 Mon Sep 17 00:00:00 2001 From: Roman Matveev Date: Wed, 9 Jul 2025 10:34:28 +0300 Subject: [PATCH] create by type, not element --- __tests__/XMLMarshaller.js | 4 +++- lib/XMLMarshaller.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/__tests__/XMLMarshaller.js b/__tests__/XMLMarshaller.js index 3261650..b4bfd3b 100644 --- a/__tests__/XMLMarshaller.js +++ b/__tests__/XMLMarshaller.js @@ -272,7 +272,7 @@ test ('20319', async () => { MessageData: { AppData: { data: { - [Symbol.for ('type')]: 'getOrganizationsByEasRequest', + [Symbol.for ('type')]: 'GetOrganizationsByEasRequest', eas: 123456, countRecord: 1, page: 1 @@ -282,6 +282,8 @@ test ('20319', async () => { } } + expect (xs.stringify (data)).toMatch (/xsi:type="ns\d*:GetOrganizationsByEasRequest"/) + expect (xs.stringify (data)).toMatch ('eas>123456<') }) diff --git a/lib/XMLMarshaller.js b/lib/XMLMarshaller.js index 1591d35..5486f84 100644 --- a/lib/XMLMarshaller.js +++ b/lib/XMLMarshaller.js @@ -111,7 +111,7 @@ const XMLMarshaller = class { if (data [XSI_TYPE]) { let d = {}; for (let k in data) d [k] = data [k] - this.appendElementBody (this.schema.get (data [XSI_TYPE]), d) + this.appendContent (this.schema.getType (data [XSI_TYPE]), d) } if (type) return this.appendContent (this.xs.getType (type), data)