xml-toolkit 1.0.2 → 1.0.5

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/test/sign.xsd ADDED
@@ -0,0 +1,71 @@
1
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2000/09/xmldsig#">
2
+ <xsd:element name="Signature" type="ds:DSSignatureType"/>
3
+ <xsd:complexType name="DSSignatureType">
4
+ <xsd:sequence>
5
+ <xsd:element minOccurs="0" ref="ds:KeyInfo"/>
6
+ <xsd:element ref="ds:SignedInfo"/>
7
+ <xsd:element ref="ds:SignatureValue"/>
8
+ </xsd:sequence>
9
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
10
+ </xsd:complexType>
11
+ <xsd:element name="SignatureValue" type="xsd:base64Binary"/>
12
+ <xsd:element name="SignedInfo" type="ds:DSSignedInfoType"/>
13
+ <xsd:complexType name="DSSignedInfoType">
14
+ <xsd:sequence>
15
+ <xsd:element ref="ds:CanonicalizationMethod"/>
16
+ <xsd:element ref="ds:SignatureMethod"/>
17
+ <xsd:element maxOccurs="unbounded" ref="ds:Reference"/>
18
+ </xsd:sequence>
19
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
20
+ </xsd:complexType>
21
+ <xsd:element name="CanonicalizationMethod" type="ds:DSCanonicalizationMethodType"/>
22
+ <xsd:complexType mixed="true" name="DSCanonicalizationMethodType">
23
+ <xsd:sequence>
24
+ <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##any"/>
25
+ </xsd:sequence>
26
+ <xsd:attribute default="http://www.w3.org/2001/10/xml-exc-c14n#" name="Algorithm" type="xsd:anyURI" use="optional"/>
27
+ </xsd:complexType>
28
+ <xsd:element name="SignatureMethod" type="ds:DSSignatureMethodType"/>
29
+ <xsd:complexType mixed="true" name="DSSignatureMethodType">
30
+ <xsd:attribute default="http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411" name="Algorithm" type="xsd:anyURI" use="optional"/>
31
+ </xsd:complexType>
32
+ <xsd:element name="Reference" type="ds:DSReferenceType"/>
33
+ <xsd:complexType name="DSReferenceType">
34
+ <xsd:sequence>
35
+ <xsd:element minOccurs="0" ref="ds:Transforms"/>
36
+ <xsd:element ref="ds:DigestMethod"/>
37
+ <xsd:element ref="ds:DigestValue"/>
38
+ </xsd:sequence>
39
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
40
+ <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
41
+ <xsd:attribute name="Type" type="xsd:anyURI" use="optional"/>
42
+ </xsd:complexType>
43
+ <xsd:element name="Transforms" type="ds:DSTransformsType"/>
44
+ <xsd:complexType name="DSTransformsType">
45
+ <xsd:sequence>
46
+ <xsd:element maxOccurs="unbounded" ref="ds:Transform"/>
47
+ </xsd:sequence>
48
+ </xsd:complexType>
49
+ <xsd:element name="Transform" type="ds:DSTransformType"/>
50
+ <xsd:complexType mixed="true" name="DSTransformType">
51
+ <xsd:attribute default="http://www.w3.org/2000/09/xmldsig#enveloped-signature" name="Algorithm" type="xsd:anyURI" use="optional"/>
52
+ </xsd:complexType>
53
+ <xsd:element name="DigestMethod" type="ds:DSDigestMethodType"/>
54
+ <xsd:complexType mixed="true" name="DSDigestMethodType">
55
+ <xsd:attribute default="http://www.w3.org/2001/04/xmldsig-more#gostr3411" name="Algorithm" type="xsd:anyURI" use="optional"/>
56
+ </xsd:complexType>
57
+ <xsd:element name="DigestValue" type="xsd:base64Binary"/>
58
+ <xsd:element name="KeyInfo" type="ds:DSKeyInfoType"/>
59
+ <xsd:complexType mixed="true" name="DSKeyInfoType">
60
+ <xsd:sequence>
61
+ <xsd:element ref="ds:X509Data"/>
62
+ </xsd:sequence>
63
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
64
+ </xsd:complexType>
65
+ <xsd:element name="X509Data" type="ds:DSX509DataType"/>
66
+ <xsd:complexType name="DSX509DataType">
67
+ <xsd:sequence maxOccurs="unbounded">
68
+ <xsd:element name="X509Certificate" type="xsd:base64Binary"/>
69
+ </xsd:sequence>
70
+ </xsd:complexType>
71
+ </xsd:schema>
package/test/test.js CHANGED
@@ -210,6 +210,66 @@ async function test_004_schemata (fn) {
210
210
 
211
211
  }
212
212
 
213
+ async function test_005_schemata (fn) {
214
+
215
+ const xs = await XMLSchemata.fromFile ('test/20040.wsdl')
216
+
217
+ const data = {
218
+
219
+ "AppData": {
220
+ "info": {
221
+ "person": {
222
+ "fNameCiv": "ППП",
223
+ "iNameCiv": "ППП",
224
+ "mNameCiv": null,
225
+ "docDatCiv": "1973-03-01"
226
+ },
227
+ "snils": "022-114-680 91",
228
+ "document": {
229
+ "codeKind": "01",
230
+ "numDoc": "999999",
231
+ "seriesDoc": "9999",
232
+ "dateDoc": "2022-03-05"
233
+ },
234
+ "startDate": "2021-08-01",
235
+ "endDate": "2022-01-31T00:00:00",
236
+ "child": {
237
+ "fNameCiv": "ООО",
238
+ "iNameCiv": "ООО",
239
+ "mNameCiv": null,
240
+ "docDatCiv": "2022-02-08"
241
+ },
242
+ "childDocument": {
243
+ "codeKind": "03",
244
+ "numDoc": "333333",
245
+ "seriesDoc": "333333333",
246
+ "dateDoc": "2022-03-01"
247
+ },
248
+ "childSnils": "109-598-827 12"
249
+ }
250
+ }
251
+
252
+ }, {info} = data.AppData
253
+
254
+ // const m = xs.createMarshaller ('AppDataChildDotation', 'http://smev.gosuslugi.ru/rev111111')
255
+
256
+ console.log (xs.stringify (
257
+
258
+ {childDotation2Request: {
259
+ Message: {
260
+ TestMsg: "Тестовый запроc",
261
+ },
262
+ MessageData: {
263
+ AppData: {
264
+ info
265
+ }
266
+ }
267
+ }}
268
+
269
+ ))
270
+
271
+ }
272
+
213
273
  async function main () {
214
274
 
215
275
  // await test_001_lexer_sync ('E05a.xml')
@@ -225,6 +285,7 @@ async function main () {
225
285
  // await test_003_emitter_sync ('ent.xml')
226
286
  // await test_003_emitter_sync ('soap.xml')
227
287
  await test_004_schemata ()
288
+ await test_005_schemata ()
228
289
 
229
290
  }
230
291