From 789f44c055d6382a228d025afc6af5678584a8b0 Mon Sep 17 00:00:00 2001 From: Artem Danilov Date: Tue, 28 Oct 2025 10:03:03 +0300 Subject: [PATCH 1/5] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D1=82=D0=B5=D1=81=D1=82,=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D1=8F=D0=B5?= =?UTF-8?q?=D1=82=20=D0=B0=D1=82=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82=20for?= =?UTF-8?q?m=3Dunqualified?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __data__/202510/wsdl_112.wsdl | 64 +++++++++++++++++++++++++++++++++++ __tests__/XMLMarshaller.js | 16 +++++++++ 2 files changed, 80 insertions(+) create mode 100644 __data__/202510/wsdl_112.wsdl diff --git a/__data__/202510/wsdl_112.wsdl b/__data__/202510/wsdl_112.wsdl new file mode 100644 index 0000000..390d040 --- /dev/null +++ b/__data__/202510/wsdl_112.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/XMLMarshaller.js b/__tests__/XMLMarshaller.js index 23b4e2e..17c7d93 100644 --- a/__tests__/XMLMarshaller.js +++ b/__tests__/XMLMarshaller.js @@ -315,6 +315,22 @@ test ('nillable', () => { }) +test ('form="unqualified"', () => { + + const xs = getXSSync (Path.join (__dirname, '..', '__data__', '202510', 'wsdl_112.wsdl')) + + const m = xs.createMarshaller ('UpdateCardResponse', 'http://eiim.service112.iskratel.si/') + + const xml = m.stringify ({ + "Code": 200, + "CodeDescr": "Descr" + } + ) + + expect (xml).toMatch ('200Descr') + +}) + test ('att simple type', () => { const xsdPath = Path.join (__dirname, '..', '__data__', 'att.xsd') From e2d247ade8be643f219a7d75095c621968e2c791 Mon Sep 17 00:00:00 2001 From: Artem Danilov Date: Tue, 28 Oct 2025 14:19:19 +0300 Subject: [PATCH 2/5] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20test=20=D0=BD=D0=B0=20xsd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __data__/202510/wsdl_112.wsdl | 64 ----------------------------------- __data__/202510/wsdl_112.xsd | 17 ++++++++++ __tests__/XMLMarshaller.js | 2 +- 3 files changed, 18 insertions(+), 65 deletions(-) delete mode 100644 __data__/202510/wsdl_112.wsdl create mode 100644 __data__/202510/wsdl_112.xsd diff --git a/__data__/202510/wsdl_112.wsdl b/__data__/202510/wsdl_112.wsdl deleted file mode 100644 index 390d040..0000000 --- a/__data__/202510/wsdl_112.wsdl +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/__data__/202510/wsdl_112.xsd b/__data__/202510/wsdl_112.xsd new file mode 100644 index 0000000..c4dce29 --- /dev/null +++ b/__data__/202510/wsdl_112.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/__tests__/XMLMarshaller.js b/__tests__/XMLMarshaller.js index 17c7d93..94c5707 100644 --- a/__tests__/XMLMarshaller.js +++ b/__tests__/XMLMarshaller.js @@ -317,7 +317,7 @@ test ('nillable', () => { test ('form="unqualified"', () => { - const xs = getXSSync (Path.join (__dirname, '..', '__data__', '202510', 'wsdl_112.wsdl')) + const xs = getXSSync (Path.join (__dirname, '..', '__data__', '202510', 'wsdl_112.xsd')) const m = xs.createMarshaller ('UpdateCardResponse', 'http://eiim.service112.iskratel.si/') From 7bec9631352e50e7098fd6b069d2c87fd46e45a6 Mon Sep 17 00:00:00 2001 From: Artem Danilov Date: Tue, 28 Oct 2025 11:43:38 +0000 Subject: [PATCH 3/5] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BB=20=D1=81=D1=85=D0=B5=D0=BC=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __data__/202510/wsdl_112.xsd | 7 ++++--- __tests__/XMLMarshaller.js | 23 ++++++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/__data__/202510/wsdl_112.xsd b/__data__/202510/wsdl_112.xsd index c4dce29..caad1b4 100644 --- a/__data__/202510/wsdl_112.xsd +++ b/__data__/202510/wsdl_112.xsd @@ -3,9 +3,10 @@ xmlns:tns="http://eiim.service112.iskratel.si/" targetNamespace="http://eiim.service112.iskratel.si/" elementFormDefault="qualified" - attributeFormDefault="unqualified"> - - + attributeFormDefault="unqualified" + > + + diff --git a/__tests__/XMLMarshaller.js b/__tests__/XMLMarshaller.js index 94c5707..479eba3 100644 --- a/__tests__/XMLMarshaller.js +++ b/__tests__/XMLMarshaller.js @@ -317,15 +317,24 @@ test ('nillable', () => { test ('form="unqualified"', () => { - const xs = getXSSync (Path.join (__dirname, '..', '__data__', '202510', 'wsdl_112.xsd')) + const xsdPath = Path.join (__dirname, '..', '__data__', '202510', 'wsdl_112.xsd') - const m = xs.createMarshaller ('UpdateCardResponse', 'http://eiim.service112.iskratel.si/') + const xs = getXSSync (xsdPath) - const xml = m.stringify ({ - "Code": 200, - "CodeDescr": "Descr" - } - ) + function stringify (data, options) { + + const xml = xs.createMarshaller ('UpdateCardResponse', 'http://eiim.service112.iskratel.si/').stringify (data, options) + + execSync (`xmllint --schema ${xsdPath} -`, {input: xml, stdio: 'pipe'}) + + return xml + + } + + let xml = stringify ({ + "Code": 200, + "CodeDescr": "Descr" + }) expect (xml).toMatch ('200Descr') From 15b4565e63215a8f48a82d6d79d0b5be9b048c3c Mon Sep 17 00:00:00 2001 From: Artem Danilov Date: Tue, 28 Oct 2025 15:08:01 +0300 Subject: [PATCH 4/5] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B0=D1=82=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82?= =?UTF-8?q?=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/XMLSchema.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/XMLSchema.js b/lib/XMLSchema.js index f5b2a9b..8031ad6 100644 --- a/lib/XMLSchema.js +++ b/lib/XMLSchema.js @@ -114,10 +114,10 @@ const XMLSchema = class extends Map { const {formDefault} = this; if (!(localName in formDefault)) return if (!force) { - + const {form} = node.attributes - - if (form !== FORM_Q && formDefault [localName] !== FORM_Q) return + + if (form !== FORM_Q || !form && formDefault [localName] !== FORM_Q) return } From 7c02a9ab8239cb444ff36f3594b6e0f6ed797626 Mon Sep 17 00:00:00 2001 From: Artem Danilov Date: Tue, 28 Oct 2025 12:45:28 +0000 Subject: [PATCH 5/5] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B0=D1=82=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82?= =?UTF-8?q?=D0=B0=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/XMLSchema.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/XMLSchema.js b/lib/XMLSchema.js index 8031ad6..a114ecd 100644 --- a/lib/XMLSchema.js +++ b/lib/XMLSchema.js @@ -110,18 +110,18 @@ const XMLSchema = class extends Map { const {localName} = node for (const e of node.children) this.copyTargetNamespace (e, localName === 'schema') - + const {formDefault} = this; if (!(localName in formDefault)) return - + if (!force) { - const {form} = node.attributes + const form = node.attributes?.form || formDefault [localName] - if (form !== FORM_Q || !form && formDefault [localName] !== FORM_Q) return + if (form !== FORM_Q) return } - node.targetNamespace = this.targetNamespace + node.targetNamespace = this.targetNamespace }