xml-toolkit 1.0.10 → 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/XMLReader.js +1 -1
- 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 +18 -4
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/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) {
|
|
@@ -327,13 +341,13 @@ async function main () {
|
|
|
327
341
|
// await test_002_lexer_stream ('param_types.xml')
|
|
328
342
|
// await test_002_lexer_stream ('not-sa02.xml')
|
|
329
343
|
// await test_003_emitter_sync ('E05a.xml')
|
|
330
|
-
|
|
344
|
+
await test_003_emitter_sync ('param_types.xml')
|
|
331
345
|
// await test_003_emitter_sync ('not-sa01.xml')
|
|
332
346
|
// await test_003_emitter_sync ('ent.xml')
|
|
333
347
|
// await test_003_emitter_sync ('soap.xml')
|
|
334
|
-
await test_004_schemata ()
|
|
335
|
-
await test_005_schemata ()
|
|
336
|
-
await test_006_schemata ()
|
|
348
|
+
// await test_004_schemata ()
|
|
349
|
+
// await test_005_schemata ()
|
|
350
|
+
// await test_006_schemata ()
|
|
337
351
|
|
|
338
352
|
}
|
|
339
353
|
|