xml-toolkit 1.0.6 → 1.0.7
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 +14 -2
- package/lib/XMLSchema.js +2 -0
- package/package.json +1 -1
- package/test/test.js +1 -1
package/lib/XMLMarshaller.js
CHANGED
|
@@ -307,9 +307,9 @@ const XMLMarshaller = class {
|
|
|
307
307
|
|
|
308
308
|
_bSequence (buf, _sequence, content) {
|
|
309
309
|
|
|
310
|
-
const {element, sequence, choice, all} = _sequence,
|
|
310
|
+
const {element, sequence, choice, all, group} = _sequence, g = sequence || choice || all
|
|
311
311
|
|
|
312
|
-
if (
|
|
312
|
+
if (g) this._bSequence (buf, g, content)
|
|
313
313
|
|
|
314
314
|
if (element) {
|
|
315
315
|
|
|
@@ -324,6 +324,18 @@ const XMLMarshaller = class {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
}
|
|
327
|
+
|
|
328
|
+
if (group) {
|
|
329
|
+
|
|
330
|
+
for (let e of Array.isArray (group) ? group : [group]) {
|
|
331
|
+
|
|
332
|
+
const {ref} = e; if (ref) e = this.xs.getByReference (ref)
|
|
333
|
+
|
|
334
|
+
this._bSequence (buf, e, content)
|
|
335
|
+
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
}
|
|
327
339
|
|
|
328
340
|
}
|
|
329
341
|
|
package/lib/XMLSchema.js
CHANGED
|
@@ -22,6 +22,7 @@ const XMLSchema = class extends Map {
|
|
|
22
22
|
'element',
|
|
23
23
|
'complexType',
|
|
24
24
|
'simpleType',
|
|
25
|
+
'group',
|
|
25
26
|
|
|
26
27
|
]) if (type in node) {
|
|
27
28
|
|
|
@@ -86,6 +87,7 @@ XMLSchema.adjustNode = node => {
|
|
|
86
87
|
|
|
87
88
|
case 'attribute':
|
|
88
89
|
case 'element':
|
|
90
|
+
case 'group':
|
|
89
91
|
splitNs ('ref')
|
|
90
92
|
splitNs ('type')
|
|
91
93
|
break
|
package/package.json
CHANGED
package/test/test.js
CHANGED
|
@@ -273,7 +273,7 @@ async function test_005_schemata (fn) {
|
|
|
273
273
|
async function test_006_schemata (fn) {
|
|
274
274
|
|
|
275
275
|
const xs = await XMLSchemata.fromFile ('test/snils-by-additionalData-1.0.1.xsd')
|
|
276
|
-
|
|
276
|
+
|
|
277
277
|
const data = {
|
|
278
278
|
"SnilsByAdditionalDataRequest": {
|
|
279
279
|
"FamilyName": "ИВАНОВ",
|