xml-toolkit 1.0.5 → 1.0.8

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.
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://kvs.pfr.com/snils-by-additionalData/1.0.1" xmlns:smev="urn://x-artefacts-smev-gov-ru/supplementary/commons/1.0.1" xmlns:pfr="http://common.kvs.pfr.com/1.0.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" targetNamespace="http://kvs.pfr.com/snils-by-additionalData/1.0.1" elementFormDefault="qualified" jxb:version="2.0">
3
+ <import namespace="urn://x-artefacts-smev-gov-ru/supplementary/commons/1.0.1" schemaLocation="commons/smev-supplementary-commons-1.0.1.xsd"/>
4
+ <import namespace="http://common.kvs.pfr.com/1.0.0" schemaLocation="commons/pfr-common-types-1.0.0.xsd"/>
5
+ <element name="SnilsByAdditionalDataRequest">
6
+ <complexType>
7
+ <sequence>
8
+ <group ref="smev:PhysicalPersonQualifiedName-ModelGroup"/>
9
+ <element name="BirthDate" type="date" nillable="false"/>
10
+ <element name="Gender" type="smev:GenderType" nillable="false"/>
11
+ <element name="BirthPlace" type="pfr:BirthPlaceType" minOccurs="0"/>
12
+ <group ref="pfr:AllIdentityDocumentType-Group" minOccurs="0"/>
13
+ </sequence>
14
+ </complexType>
15
+ </element>
16
+ <element name="SnilsByAdditionalDataResponse">
17
+ <complexType>
18
+ <sequence>
19
+ <group ref="smev:PhysicalPersonQualifiedName-ModelGroup"/>
20
+ <element name="Snils" type="smev:SNILSType" nillable="false"/>
21
+ <element name="BirthDate" type="date" nillable="false"/>
22
+ <element name="Gender" type="smev:GenderType" nillable="false"/>
23
+ <element name="BirthPlace" type="pfr:BirthPlaceType" minOccurs="0"/>
24
+ <group ref="pfr:AllIdentityDocumentType-Group" minOccurs="0"/>
25
+ </sequence>
26
+ </complexType>
27
+ </element>
28
+ </schema>
29
+
package/test/test.js CHANGED
@@ -59,12 +59,15 @@ console.log (xml)
59
59
 
60
60
  const sax = new XMLReader ({
61
61
  // stripSpace: true,
62
+ // filterElements: 'root',
63
+ // filterElements: 'PARAMTYPES'
62
64
  filterElements: 'SendRequestRequest',
63
- map: XMLNode.toObject ({
65
+ map: n => n.detach ({nsMap: true}),
66
+ // map: XMLNode.toObject ({
64
67
  // wrap: 1,
65
- getName: (localName, namespaceURI) => (!namespaceURI ? '' : '{' + namespaceURI + '}') + localName,
66
- map: o => Object.fromEntries (Object.entries (o).map (([k, v]) => [k + '111', v]))
67
- })
68
+ // getName: (localName, namespaceURI) => (!namespaceURI ? '' : '{' + namespaceURI + '}') + localName,
69
+ // map: o => Object.fromEntries (Object.entries (o).map (([k, v]) => [k + '111', v]))
70
+ // })
68
71
  })
69
72
 
70
73
  /*
@@ -111,8 +114,13 @@ async function test_004_schemata (fn) {
111
114
  const o = s.get (localName)
112
115
 
113
116
  const nspm = xs.getNamespacePrefixesMap (o)
114
- */
117
+ */
118
+
115
119
  console.log (xs.stringify ({
120
+ "ExportDebtRequestsRequest": {Id: 1}
121
+ }))
122
+
123
+ if (0) console.log (xs.stringify ({
116
124
  "ExportDebtRequestsResponse": {
117
125
  "request-data": {
118
126
  "request-id": "bac4c940-6ad3-11eb-9439-0242ac130002",
@@ -270,6 +278,39 @@ async function test_005_schemata (fn) {
270
278
 
271
279
  }
272
280
 
281
+ async function test_006_schemata (fn) {
282
+
283
+ const xs = await XMLSchemata.fromFile ('test/snils-by-additionalData-1.0.1.xsd')
284
+
285
+ const data = {
286
+ "SnilsByAdditionalDataRequest": {
287
+ "FamilyName": "ИВАНОВ",
288
+ "FirstName": "ИВАН",
289
+ "Patronymic": "ИВАНОВИЧ",
290
+ "BirthDate": "1967-05-21",
291
+ "Gender": "Male",
292
+ "BirthPlace": {
293
+ "PlaceType": "ОСОБОЕ",
294
+ "Settlement": "ЗАГОРСК",
295
+ "District": "ЛЕНИНСКИЙ",
296
+ "Region": "МОСКОВСКАЯ ОБЛАСТЬ",
297
+ "Country": "РФ"
298
+ },
299
+ "PassportRF": {
300
+ "Series": "0005",
301
+ "Number": "777777",
302
+ "IssueDate": "1986-06-13",
303
+ "Issuer": "ОВД"
304
+ }
305
+ }
306
+ }
307
+
308
+ // const m = xs.createMarshaller ('AppDataChildDotation', 'http://smev.gosuslugi.ru/rev111111')
309
+
310
+ console.log (xs.stringify (data))
311
+
312
+ }
313
+
273
314
  async function main () {
274
315
 
275
316
  // await test_001_lexer_sync ('E05a.xml')
@@ -282,10 +323,11 @@ async function main () {
282
323
  // await test_003_emitter_sync ('E05a.xml')
283
324
  // await test_003_emitter_sync ('param_types.xml')
284
325
  // await test_003_emitter_sync ('not-sa01.xml')
285
- // await test_003_emitter_sync ('ent.xml')
326
+ // await test_003_emitter_sync ('ent.xml')
286
327
  // await test_003_emitter_sync ('soap.xml')
287
- await test_004_schemata ()
328
+ // await test_004_schemata ()
288
329
  await test_005_schemata ()
330
+ // await test_006_schemata ()
289
331
 
290
332
  }
291
333