xml-toolkit 1.0.8 → 1.0.11
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/NamespacePrefixesMap.js +13 -33
- package/lib/XMLMarshaller.js +52 -34
- package/lib/XMLNode.js +4 -2
- package/lib/XMLReader.js +1 -1
- package/lib/XMLSchemata.js +1 -7
- package/package.json +1 -1
- package/test/F9ASyncService.xsd +33 -0
- package/test/F9ASyncService_1.wsdl +72 -0
- package/test/F9ASyncService_1.xsd +43 -0
- package/test/F9ASyncService_1_2.xsd +42 -0
- package/test/test.js +24 -4
|
@@ -2,53 +2,33 @@ const assert = require ('assert')
|
|
|
2
2
|
|
|
3
3
|
const NamespacePrefixesMap = class extends Map {
|
|
4
4
|
|
|
5
|
-
constructor (schemata
|
|
5
|
+
constructor (schemata) {
|
|
6
6
|
|
|
7
|
-
assert.strictEqual (typeof o, 'object')
|
|
8
|
-
|
|
9
7
|
super ()
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
for (const uri of schemata.keys ())
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
this.set (uri, 'ns' + this.size)
|
|
14
12
|
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
add (o) {
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
for (let v of Object.values (o)) if (typeof v === 'object') this.add (v)
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
isAddedAsNamespaceReference (a) {
|
|
15
|
+
QName (localName, namespaceURI) {
|
|
26
16
|
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const uri = a [1]
|
|
32
|
-
|
|
33
|
-
if (!this.schemata.has (uri)) return false
|
|
17
|
+
if (namespaceURI == null) return localName
|
|
18
|
+
|
|
19
|
+
assert (this.has (namespaceURI), 'Unknown target namespace: ' + namespaceURI)
|
|
34
20
|
|
|
35
|
-
if (this.has (uri)) return true
|
|
36
|
-
|
|
37
|
-
this.set (uri, 'ns' + this.size)
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
QName (localName, namespaceURI) {
|
|
42
|
-
|
|
43
|
-
if (namespaceURI == null || !this.has (namespaceURI)) return localName
|
|
44
|
-
|
|
45
21
|
return this.get (namespaceURI) + ':' + localName
|
|
46
22
|
|
|
47
23
|
}
|
|
48
24
|
|
|
49
|
-
|
|
25
|
+
toString () {
|
|
26
|
+
|
|
27
|
+
let s = ''
|
|
50
28
|
|
|
51
|
-
for (let [k, v] of this.entries ())
|
|
29
|
+
for (let [k, v] of this.entries ()) s += ' xmlns:' + v + '="' + k + '"'
|
|
30
|
+
|
|
31
|
+
return s
|
|
52
32
|
|
|
53
33
|
}
|
|
54
34
|
|
package/lib/XMLMarshaller.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const assert = require ('assert')
|
|
2
2
|
const stringEscape = require ('string-escape-map')
|
|
3
|
+
const NamespacePrefixesMap = require ('./NamespacePrefixesMap.js')
|
|
3
4
|
|
|
4
5
|
let esc = [
|
|
5
6
|
['<', '<'],
|
|
@@ -33,33 +34,65 @@ const XMLMarshaller = class {
|
|
|
33
34
|
|
|
34
35
|
this.schemaElement = this.schema.get (localName); assert (this.schemaElement, 'No schema element found for namespaceURI = ' + namespaceURI + ', localName = ' + localName)
|
|
35
36
|
|
|
36
|
-
this.ns =
|
|
37
|
+
this.ns = new NamespacePrefixesMap (xs)
|
|
38
|
+
|
|
39
|
+
this.isNsDumped = false
|
|
40
|
+
|
|
41
|
+
this.qNames = []
|
|
37
42
|
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
stringify (data, name) {
|
|
41
|
-
|
|
46
|
+
|
|
42
47
|
const {schemaElement} = this, {targetNamespace, attributes, children} = schemaElement
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
this.buf = ''
|
|
50
|
+
|
|
51
|
+
this.appendElement (schemaElement, data, this.ns.QName (name || attributes.name, targetNamespace))
|
|
52
|
+
|
|
53
|
+
let xml = this.buf
|
|
54
|
+
|
|
55
|
+
delete this.buf
|
|
56
|
+
|
|
57
|
+
return xml
|
|
45
58
|
|
|
46
|
-
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
appendElement (node, data, qName) {
|
|
62
|
+
|
|
63
|
+
this.appendStartTag (node, data, qName)
|
|
47
64
|
|
|
48
|
-
this.
|
|
65
|
+
this.appendElementBody (node, data)
|
|
49
66
|
|
|
50
|
-
this.
|
|
67
|
+
this.appendEndTag ()
|
|
51
68
|
|
|
52
|
-
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
appendStartTag (node, data, qName) {
|
|
72
|
+
|
|
73
|
+
this.qNames.push (qName)
|
|
74
|
+
|
|
75
|
+
this.buf += '<' + qName
|
|
76
|
+
|
|
77
|
+
if (!this.isNsDumped) {
|
|
53
78
|
|
|
54
|
-
|
|
79
|
+
this.buf += this.ns
|
|
55
80
|
|
|
56
|
-
|
|
81
|
+
this.isNsDumped = true
|
|
57
82
|
|
|
58
|
-
|
|
83
|
+
}
|
|
59
84
|
|
|
60
|
-
|
|
85
|
+
this.appendAttributes (node, data)
|
|
61
86
|
|
|
62
|
-
|
|
87
|
+
this.buf += '>'
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
appendEndTag () {
|
|
92
|
+
|
|
93
|
+
this.buf += '</' + this.qNames.pop () + '>'
|
|
94
|
+
|
|
95
|
+
}
|
|
63
96
|
|
|
64
97
|
appendNullElement (node) {
|
|
65
98
|
|
|
@@ -69,7 +102,7 @@ const XMLMarshaller = class {
|
|
|
69
102
|
|
|
70
103
|
const qName = this.ns.QName (name, targetNamespace)
|
|
71
104
|
|
|
72
|
-
this.buf
|
|
105
|
+
this.buf += `<${qName} xsi:nil="true" />`
|
|
73
106
|
|
|
74
107
|
}
|
|
75
108
|
|
|
@@ -87,7 +120,7 @@ const XMLMarshaller = class {
|
|
|
87
120
|
|
|
88
121
|
}
|
|
89
122
|
|
|
90
|
-
this.buf
|
|
123
|
+
this.buf += this.to_string (data, node.attributes.name, restriction)
|
|
91
124
|
|
|
92
125
|
}
|
|
93
126
|
|
|
@@ -109,21 +142,17 @@ const XMLMarshaller = class {
|
|
|
109
142
|
|
|
110
143
|
switch (localName) {
|
|
111
144
|
|
|
112
|
-
case 'simpleType':
|
|
113
|
-
|
|
114
|
-
return this.appendScalar (node, data)
|
|
115
|
-
|
|
116
145
|
case 'attribute':
|
|
117
146
|
|
|
118
147
|
if (!(name in data)) return
|
|
119
148
|
|
|
120
149
|
let v = data [name]; if (v == null) return
|
|
121
150
|
|
|
122
|
-
this.buf
|
|
151
|
+
this.buf += ' ' + this.ns.QName (name, targetNamespace) + '="'
|
|
123
152
|
|
|
124
153
|
this.appendScalar (this.xs.getByReference (type), v)
|
|
125
154
|
|
|
126
|
-
this.buf
|
|
155
|
+
this.buf += '"'
|
|
127
156
|
|
|
128
157
|
break
|
|
129
158
|
|
|
@@ -135,6 +164,7 @@ const XMLMarshaller = class {
|
|
|
135
164
|
case 'sequence':
|
|
136
165
|
case 'choice':
|
|
137
166
|
case 'group':
|
|
167
|
+
case 'simpleType':
|
|
138
168
|
|
|
139
169
|
return
|
|
140
170
|
|
|
@@ -163,24 +193,12 @@ const XMLMarshaller = class {
|
|
|
163
193
|
if (!(name in data)) return
|
|
164
194
|
|
|
165
195
|
let v = data [name]; if (v == null) return this.appendNullElement (node)
|
|
166
|
-
|
|
167
|
-
if (!Array.isArray (v)) v = [v]
|
|
168
196
|
|
|
169
197
|
const qName = this.ns.QName (name, targetNamespace)
|
|
170
198
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this.buf [0] += '<' + qName
|
|
174
|
-
|
|
175
|
-
this.appendAttributes (node, d)
|
|
176
|
-
|
|
177
|
-
this.buf [0] += '>'
|
|
178
|
-
|
|
179
|
-
this.appendElementBody (node, d)
|
|
180
|
-
|
|
181
|
-
this.buf [0] += '</' + qName + '>'
|
|
199
|
+
if (!Array.isArray (v)) return this.appendElement (node, v, qName)
|
|
182
200
|
|
|
183
|
-
|
|
201
|
+
for (const d of v) this.appendElement (node, d, qName)
|
|
184
202
|
|
|
185
203
|
break
|
|
186
204
|
|
package/lib/XMLNode.js
CHANGED
|
@@ -10,6 +10,10 @@ const PARENT = Symbol ('_parent')
|
|
|
10
10
|
const LEVEL = Symbol ('_level')
|
|
11
11
|
const NS_MAP = Symbol ('_ns_map')
|
|
12
12
|
|
|
13
|
+
const m2o =
|
|
14
|
+
Object.fromEntries ? m => Object.fromEntries (m.entries ()) :
|
|
15
|
+
m => {let o = {}; for (const [k, v] of m.entries ()) o [k] = v; return o}
|
|
16
|
+
|
|
13
17
|
const XMLNode = class extends SAXEvent {
|
|
14
18
|
|
|
15
19
|
constructor (src, xmlReader, _type) {
|
|
@@ -142,8 +146,6 @@ const XMLNode = class extends SAXEvent {
|
|
|
142
146
|
|
|
143
147
|
default:
|
|
144
148
|
|
|
145
|
-
const m2o = m => Object.fromEntries (m.entries ())
|
|
146
|
-
|
|
147
149
|
const {localName, namespaceURI, attributes, children, namespacesMap} = this
|
|
148
150
|
|
|
149
151
|
let r = {
|
package/lib/XMLReader.js
CHANGED
|
@@ -214,7 +214,7 @@ const XMLReader = class extends Transform {
|
|
|
214
214
|
|
|
215
215
|
case SAXEvent.TYPES.END_ELEMENT:
|
|
216
216
|
|
|
217
|
-
if (element === null)
|
|
217
|
+
if (element === null) return callback (new Error (`Unbalanced end element tag "${chunk}" occured at position ${this.position}`))
|
|
218
218
|
|
|
219
219
|
e = element
|
|
220
220
|
|
package/lib/XMLSchemata.js
CHANGED
|
@@ -59,12 +59,6 @@ const XMLSchemata = class extends Map {
|
|
|
59
59
|
for (const uri of ns) return this.get (uri)
|
|
60
60
|
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
getNamespacePrefixesMap (o) {
|
|
64
|
-
|
|
65
|
-
return new NamespacePrefixesMap (this, o)
|
|
66
|
-
|
|
67
|
-
}
|
|
68
62
|
|
|
69
63
|
createMarshaller (localName, namespaceURI) {
|
|
70
64
|
|
|
@@ -114,7 +108,7 @@ const XMLSchemata = class extends Map {
|
|
|
114
108
|
|
|
115
109
|
}
|
|
116
110
|
|
|
117
|
-
const {targetNamespace} = options, mapper = n => n.detach (
|
|
111
|
+
const {targetNamespace} = options, mapper = n => n.detach ()
|
|
118
112
|
|
|
119
113
|
for await (const node of
|
|
120
114
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/">
|
|
3
|
+
<xs:import schemaLocation="F9ASyncService_1.xsd" namespace="http://schemas.datacontract.org/2004/07/GetForm9ASync"/>
|
|
4
|
+
<xs:element name="GetForm9Async">
|
|
5
|
+
<xs:complexType>
|
|
6
|
+
<xs:sequence>
|
|
7
|
+
<xs:element minOccurs="0" name="person" nillable="true" type="q1:Person" xmlns:q1="http://schemas.datacontract.org/2004/07/GetForm9ASync"/>
|
|
8
|
+
<xs:element minOccurs="0" name="address" nillable="true" type="q2:Address" xmlns:q2="http://schemas.datacontract.org/2004/07/GetForm9ASync"/>
|
|
9
|
+
</xs:sequence>
|
|
10
|
+
</xs:complexType>
|
|
11
|
+
</xs:element>
|
|
12
|
+
<xs:element name="GetForm9AsyncResponse">
|
|
13
|
+
<xs:complexType>
|
|
14
|
+
<xs:sequence>
|
|
15
|
+
<xs:element minOccurs="0" name="GetForm9AsyncResult" nillable="true" type="q3:Responce" xmlns:q3="http://schemas.datacontract.org/2004/07/GetForm9ASync"/>
|
|
16
|
+
</xs:sequence>
|
|
17
|
+
</xs:complexType>
|
|
18
|
+
</xs:element>
|
|
19
|
+
<xs:element name="GetStatus">
|
|
20
|
+
<xs:complexType>
|
|
21
|
+
<xs:sequence>
|
|
22
|
+
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
|
|
23
|
+
</xs:sequence>
|
|
24
|
+
</xs:complexType>
|
|
25
|
+
</xs:element>
|
|
26
|
+
<xs:element name="GetStatusResponse">
|
|
27
|
+
<xs:complexType>
|
|
28
|
+
<xs:sequence>
|
|
29
|
+
<xs:element minOccurs="0" name="GetStatusResult" nillable="true" type="q4:Result" xmlns:q4="http://schemas.datacontract.org/2004/07/GetForm9ASync"/>
|
|
30
|
+
</xs:sequence>
|
|
31
|
+
</xs:complexType>
|
|
32
|
+
</xs:element>
|
|
33
|
+
</xs:schema>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:i0="http://schemas.datacontract.org/2004/07/GetForm9ASync" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:ns0="http://tempuri.org/Imports" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/">
|
|
3
|
+
|
|
4
|
+
<wsdl:types>
|
|
5
|
+
|
|
6
|
+
<xsd:schema targetNamespace="http://tempuri.org/Imports" elementFormDefault="unqualified" attributeFormDefault="unqualified">
|
|
7
|
+
<xsd:import schemaLocation="F9ASyncService.xsd" namespace="http://tempuri.org/" />
|
|
8
|
+
<xsd:import schemaLocation="F9ASyncService_1_2.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
|
|
9
|
+
<xsd:import schemaLocation="F9ASyncService_1.xsd" namespace="http://schemas.datacontract.org/2004/07/GetForm9ASync" />
|
|
10
|
+
</xsd:schema>
|
|
11
|
+
|
|
12
|
+
</wsdl:types>
|
|
13
|
+
|
|
14
|
+
<wsdl:message name="IF9Service_GetForm9Async_InputMessage">
|
|
15
|
+
<wsdl:part name="parameters" element="tns:GetForm9Async" />
|
|
16
|
+
</wsdl:message>
|
|
17
|
+
|
|
18
|
+
<wsdl:message name="IF9Service_GetForm9Async_OutputMessage">
|
|
19
|
+
<wsdl:part name="parameters" element="tns:GetForm9AsyncResponse" />
|
|
20
|
+
</wsdl:message>
|
|
21
|
+
|
|
22
|
+
<wsdl:message name="IF9Service_GetStatus_InputMessage">
|
|
23
|
+
<wsdl:part name="parameters" element="tns:GetStatus" />
|
|
24
|
+
</wsdl:message>
|
|
25
|
+
|
|
26
|
+
<wsdl:message name="IF9Service_GetStatus_OutputMessage">
|
|
27
|
+
<wsdl:part name="parameters" element="tns:GetStatusResponse" />
|
|
28
|
+
</wsdl:message>
|
|
29
|
+
|
|
30
|
+
<wsdl:portType name="VCKP_F9ASyncService_v2PortType">
|
|
31
|
+
|
|
32
|
+
<wsdl:operation name="GetForm9Async">
|
|
33
|
+
<wsdl:input wsaw:Action="http://tempuri.org/IF9Service/GetForm9Async" message="tns:IF9Service_GetForm9Async_InputMessage" />
|
|
34
|
+
<wsdl:output wsaw:Action="http://tempuri.org/IF9Service/GetForm9AsyncResponse" message="tns:IF9Service_GetForm9Async_OutputMessage" />
|
|
35
|
+
</wsdl:operation>
|
|
36
|
+
|
|
37
|
+
<wsdl:operation name="GetStatus">
|
|
38
|
+
<wsdl:input wsaw:Action="http://tempuri.org/IF9Service/GetStatus" message="tns:IF9Service_GetStatus_InputMessage" />
|
|
39
|
+
<wsdl:output wsaw:Action="http://tempuri.org/IF9Service/GetStatusResponse" message="tns:IF9Service_GetStatus_OutputMessage" />
|
|
40
|
+
</wsdl:operation>
|
|
41
|
+
</wsdl:portType>
|
|
42
|
+
|
|
43
|
+
<wsdl:binding name="VCKP_F9ASyncService_v2Soap11Binding" type="tns:VCKP_F9ASyncService_v2PortType">
|
|
44
|
+
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|
|
45
|
+
|
|
46
|
+
<wsdl:operation name="GetForm9Async">
|
|
47
|
+
<soap:operation style="document" soapAction="http://tempuri.org/IF9Service/GetForm9Async" />
|
|
48
|
+
<wsdl:input>
|
|
49
|
+
<soap:body use="literal" />
|
|
50
|
+
</wsdl:input>
|
|
51
|
+
<wsdl:output>
|
|
52
|
+
<soap:body use="literal" />
|
|
53
|
+
</wsdl:output>
|
|
54
|
+
</wsdl:operation>
|
|
55
|
+
|
|
56
|
+
<wsdl:operation name="GetStatus">
|
|
57
|
+
<soap:operation style="document" soapAction="http://tempuri.org/IF9Service/GetStatus" />
|
|
58
|
+
<wsdl:input>
|
|
59
|
+
<soap:body use="literal" />
|
|
60
|
+
</wsdl:input>
|
|
61
|
+
<wsdl:output>
|
|
62
|
+
<soap:body use="literal" />
|
|
63
|
+
</wsdl:output>
|
|
64
|
+
</wsdl:operation>
|
|
65
|
+
</wsdl:binding>
|
|
66
|
+
|
|
67
|
+
<wsdl:service name="VCKP_F9ASyncService_v2">
|
|
68
|
+
<wsdl:port name="VCKP_F9ASyncService_v2HttpSoap11Endpoint" binding="tns:VCKP_F9ASyncService_v2Soap11Binding">
|
|
69
|
+
<soap:address location="http://esb.smev.vpn:10180/services/VCKP_F9ASyncService_v2.VCKP_F9ASyncService_v2HttpSoap11Endpoint" />
|
|
70
|
+
</wsdl:port>
|
|
71
|
+
</wsdl:service>
|
|
72
|
+
</wsdl:definitions>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xs:schema elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/GetForm9ASync" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/GetForm9ASync">
|
|
3
|
+
<xs:complexType name="Person">
|
|
4
|
+
<xs:sequence>
|
|
5
|
+
<xs:element name="LastName" nillable="true" type="xs:string"/>
|
|
6
|
+
<xs:element name="FirstName" nillable="true" type="xs:string"/>
|
|
7
|
+
<xs:element name="SecondName" nillable="true" type="xs:string"/>
|
|
8
|
+
<xs:element name="BirthDate" type="xs:dateTime"/>
|
|
9
|
+
</xs:sequence>
|
|
10
|
+
</xs:complexType>
|
|
11
|
+
<xs:element name="Person" nillable="true" type="tns:Person"/>
|
|
12
|
+
<xs:complexType name="Address">
|
|
13
|
+
<xs:sequence>
|
|
14
|
+
<xs:element name="Region" nillable="true" type="tns:Dict"/>
|
|
15
|
+
<xs:element name="Street" nillable="true" type="tns:Dict"/>
|
|
16
|
+
<xs:element name="House" nillable="true" type="xs:string"/>
|
|
17
|
+
<xs:element minOccurs="0" name="Block" nillable="true" type="xs:string"/>
|
|
18
|
+
<xs:element minOccurs="0" name="Flat" nillable="true" type="xs:string"/>
|
|
19
|
+
</xs:sequence>
|
|
20
|
+
</xs:complexType>
|
|
21
|
+
<xs:element name="Address" nillable="true" type="tns:Address"/>
|
|
22
|
+
<xs:complexType name="Dict">
|
|
23
|
+
<xs:sequence>
|
|
24
|
+
<xs:element name="Code" type="xs:int"/>
|
|
25
|
+
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string"/>
|
|
26
|
+
</xs:sequence>
|
|
27
|
+
</xs:complexType>
|
|
28
|
+
<xs:element name="Dict" nillable="true" type="tns:Dict"/>
|
|
29
|
+
<xs:complexType name="Responce">
|
|
30
|
+
<xs:sequence>
|
|
31
|
+
<xs:element minOccurs="0" name="ID" nillable="true" type="xs:string"/>
|
|
32
|
+
<xs:element name="Fault" nillable="true" type="tns:Dict"/>
|
|
33
|
+
</xs:sequence>
|
|
34
|
+
</xs:complexType>
|
|
35
|
+
<xs:element name="Responce" nillable="true" type="tns:Responce"/>
|
|
36
|
+
<xs:complexType name="Result">
|
|
37
|
+
<xs:sequence>
|
|
38
|
+
<xs:element minOccurs="0" name="Document" nillable="true" type="xs:string"/>
|
|
39
|
+
<xs:element name="Status" nillable="true" type="tns:Dict"/>
|
|
40
|
+
</xs:sequence>
|
|
41
|
+
</xs:complexType>
|
|
42
|
+
<xs:element name="Result" nillable="true" type="tns:Result"/>
|
|
43
|
+
</xs:schema>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
|
|
3
|
+
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
|
|
4
|
+
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
|
|
5
|
+
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
|
|
6
|
+
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
|
|
7
|
+
<xs:element name="byte" nillable="true" type="xs:byte"/>
|
|
8
|
+
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
|
|
9
|
+
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
|
|
10
|
+
<xs:element name="double" nillable="true" type="xs:double"/>
|
|
11
|
+
<xs:element name="float" nillable="true" type="xs:float"/>
|
|
12
|
+
<xs:element name="int" nillable="true" type="xs:int"/>
|
|
13
|
+
<xs:element name="long" nillable="true" type="xs:long"/>
|
|
14
|
+
<xs:element name="QName" nillable="true" type="xs:QName"/>
|
|
15
|
+
<xs:element name="short" nillable="true" type="xs:short"/>
|
|
16
|
+
<xs:element name="string" nillable="true" type="xs:string"/>
|
|
17
|
+
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
|
|
18
|
+
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
|
|
19
|
+
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
|
|
20
|
+
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
|
|
21
|
+
<xs:element name="char" nillable="true" type="tns:char"/>
|
|
22
|
+
<xs:simpleType name="char">
|
|
23
|
+
<xs:restriction base="xs:int"/>
|
|
24
|
+
</xs:simpleType>
|
|
25
|
+
<xs:element name="duration" nillable="true" type="tns:duration"/>
|
|
26
|
+
<xs:simpleType name="duration">
|
|
27
|
+
<xs:restriction base="xs:duration">
|
|
28
|
+
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
|
|
29
|
+
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
|
|
30
|
+
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
|
|
31
|
+
</xs:restriction>
|
|
32
|
+
</xs:simpleType>
|
|
33
|
+
<xs:element name="guid" nillable="true" type="tns:guid"/>
|
|
34
|
+
<xs:simpleType name="guid">
|
|
35
|
+
<xs:restriction base="xs:string">
|
|
36
|
+
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
|
|
37
|
+
</xs:restriction>
|
|
38
|
+
</xs:simpleType>
|
|
39
|
+
<xs:attribute name="FactoryType" type="xs:QName"/>
|
|
40
|
+
<xs:attribute name="Id" type="xs:ID"/>
|
|
41
|
+
<xs:attribute name="Ref" type="xs:IDREF"/>
|
|
42
|
+
</xs:schema>
|
package/test/test.js
CHANGED
|
@@ -97,10 +97,24 @@ console.log (xml)
|
|
|
97
97
|
*/
|
|
98
98
|
//console.log ([xml, s])
|
|
99
99
|
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
100
105
|
const v = await sax.process (xml).findFirst ()
|
|
101
106
|
|
|
102
107
|
console.log (JSON.stringify (v, null, 2))
|
|
103
108
|
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
catch (x) {
|
|
112
|
+
console.log ({x})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
async function test_004_schemata (fn) {
|
|
@@ -114,13 +128,13 @@ async function test_004_schemata (fn) {
|
|
|
114
128
|
const o = s.get (localName)
|
|
115
129
|
|
|
116
130
|
const nspm = xs.getNamespacePrefixesMap (o)
|
|
117
|
-
*/
|
|
118
131
|
|
|
119
132
|
console.log (xs.stringify ({
|
|
120
133
|
"ExportDebtRequestsRequest": {Id: 1}
|
|
121
134
|
}))
|
|
135
|
+
*/
|
|
122
136
|
|
|
123
|
-
|
|
137
|
+
console.log (xs.stringify ({
|
|
124
138
|
"ExportDebtRequestsResponse": {
|
|
125
139
|
"request-data": {
|
|
126
140
|
"request-id": "bac4c940-6ad3-11eb-9439-0242ac130002",
|
|
@@ -216,6 +230,12 @@ async function test_004_schemata (fn) {
|
|
|
216
230
|
console.log (xs.get ('urn:dom.gosuslugi.ru/debt-requests/1.0.0').get ('ActionType').restriction)
|
|
217
231
|
*/
|
|
218
232
|
|
|
233
|
+
console.log (xs.stringify ({
|
|
234
|
+
"ExportDebtRequestsRequest": {Id: 1}
|
|
235
|
+
}))
|
|
236
|
+
|
|
237
|
+
// console.log (xs.get ('urn:dom.gosuslugi.ru/debt-responses/1.0.0').get ('AttachmentType'))
|
|
238
|
+
|
|
219
239
|
}
|
|
220
240
|
|
|
221
241
|
async function test_005_schemata (fn) {
|
|
@@ -321,12 +341,12 @@ async function main () {
|
|
|
321
341
|
// await test_002_lexer_stream ('param_types.xml')
|
|
322
342
|
// await test_002_lexer_stream ('not-sa02.xml')
|
|
323
343
|
// await test_003_emitter_sync ('E05a.xml')
|
|
324
|
-
|
|
344
|
+
await test_003_emitter_sync ('param_types.xml')
|
|
325
345
|
// await test_003_emitter_sync ('not-sa01.xml')
|
|
326
346
|
// await test_003_emitter_sync ('ent.xml')
|
|
327
347
|
// await test_003_emitter_sync ('soap.xml')
|
|
328
348
|
// await test_004_schemata ()
|
|
329
|
-
await test_005_schemata ()
|
|
349
|
+
// await test_005_schemata ()
|
|
330
350
|
// await test_006_schemata ()
|
|
331
351
|
|
|
332
352
|
}
|