xml-toolkit 1.0.21 → 1.0.22

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.
@@ -144,6 +144,18 @@ const XMLMarshaller = class {
144
144
 
145
145
  switch (localName) {
146
146
 
147
+ case 'anyAttribute':
148
+
149
+ if (null in data)
150
+
151
+ for (const o of Object.values (data [null]))
152
+
153
+ for (const [k, v] of Object.entries (o))
154
+
155
+ this.buf += ' ' + k + '="' + XML_ATTR.escape ('' + v) + '"'
156
+
157
+ break
158
+
147
159
  case 'attribute':
148
160
 
149
161
  if (!(name in data)) return
@@ -203,6 +215,10 @@ const XMLMarshaller = class {
203
215
 
204
216
  switch (localName) {
205
217
 
218
+ case 'any':
219
+ if (null in data) for (const xml in data [null]) this.buf += xml
220
+ break
221
+
206
222
  case 'simpleType':
207
223
 
208
224
  return this.appendScalar (node, data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xml-toolkit",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Collection of classes for dealing with XML",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test/soap.xsd ADDED
@@ -0,0 +1,127 @@
1
+ <?xml version='1.0' encoding='UTF-8' ?>
2
+
3
+ <!-- Schema for the SOAP/1.1 envelope
4
+
5
+ Portions © 2001 DevelopMentor.
6
+ © 2001 W3C (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
7
+
8
+ This document is governed by the W3C Software License [1] as described in the FAQ [2].
9
+ [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
10
+ [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
11
+ By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
12
+
13
+ Permission to use, copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
14
+
15
+ 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
16
+
17
+ 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
18
+
19
+ 3. Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
20
+
21
+ Original W3C files; http://www.w3.org/2001/06/soap-envelope
22
+ Changes made:
23
+ - reverted namespace to http://schemas.xmlsoap.org/soap/envelope/
24
+ - reverted mustUnderstand to only allow 0 and 1 as lexical values
25
+ - made encodingStyle a global attribute 20020825
26
+ - removed default value from mustUnderstand attribute declaration
27
+
28
+ THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
29
+
30
+ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
31
+
32
+ The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
33
+
34
+ -->
35
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
36
+ xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/"
37
+ targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" >
38
+
39
+
40
+ <!-- Envelope, header and body -->
41
+ <xs:element name="Envelope" type="tns:Envelope" />
42
+ <xs:complexType name="Envelope" >
43
+ <xs:sequence>
44
+ <xs:element ref="tns:Header" minOccurs="0" />
45
+ <xs:element ref="tns:Body" minOccurs="1" />
46
+ <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
47
+ </xs:sequence>
48
+ <xs:anyAttribute namespace="##other" processContents="lax" />
49
+ </xs:complexType>
50
+
51
+ <xs:element name="Header" type="tns:Header" />
52
+ <xs:complexType name="Header" >
53
+ <xs:sequence>
54
+ <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
55
+ </xs:sequence>
56
+ <xs:anyAttribute namespace="##other" processContents="lax" />
57
+ </xs:complexType>
58
+
59
+
60
+ <xs:element name="Body" type="tns:Body_" />
61
+ <xs:complexType name="Body_" >
62
+ <xs:sequence>
63
+ <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
64
+ </xs:sequence>
65
+ <xs:anyAttribute namespace="##any" processContents="lax" >
66
+ <xs:annotation>
67
+ <xs:documentation>
68
+ Prose in the spec does not specify that attributes are allowed on the Body element
69
+ </xs:documentation>
70
+ </xs:annotation>
71
+ </xs:anyAttribute>
72
+ </xs:complexType>
73
+
74
+
75
+ <!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. -->
76
+ <xs:attribute name="mustUnderstand" >
77
+ <xs:simpleType>
78
+ <xs:restriction base='xs:boolean'>
79
+ <xs:pattern value='0|1' />
80
+ </xs:restriction>
81
+ </xs:simpleType>
82
+ </xs:attribute>
83
+ <xs:attribute name="actor" type="xs:anyURI" />
84
+
85
+ <xs:simpleType name="encodingStyle" >
86
+ <xs:annotation>
87
+ <xs:documentation>
88
+ 'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification
89
+ </xs:documentation>
90
+ </xs:annotation>
91
+ <xs:list itemType="xs:anyURI" />
92
+ </xs:simpleType>
93
+
94
+ <xs:attribute name="encodingStyle" type="tns:encodingStyle" />
95
+ <xs:attributeGroup name="encodingStyle" >
96
+ <xs:attribute ref="tns:encodingStyle" />
97
+ </xs:attributeGroup>
98
+
99
+ <xs:element name="Fault" type="tns:Fault" />
100
+ <xs:complexType name="Fault" final="extension" >
101
+ <xs:annotation>
102
+ <xs:documentation>
103
+ Fault reporting structure
104
+ </xs:documentation>
105
+ </xs:annotation>
106
+ <xs:sequence>
107
+ <xs:element name="faultcode" type="xs:QName" />
108
+ <xs:element name="faultstring" type="xs:string" />
109
+ <xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
110
+ <xs:element name="detail" type="tns:detail" minOccurs="0" />
111
+ </xs:sequence>
112
+ </xs:complexType>
113
+
114
+ <xs:complexType name="detail">
115
+ <xs:sequence>
116
+ <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
117
+ </xs:sequence>
118
+ <xs:anyAttribute namespace="##any" processContents="lax" />
119
+ </xs:complexType>
120
+
121
+ </xs:schema>
122
+
123
+
124
+
125
+
126
+
127
+
package/test/test.js CHANGED
@@ -453,6 +453,21 @@ for (const element of doc.children) {
453
453
 
454
454
  }
455
455
 
456
+ function test_013_soap () {
457
+
458
+ const xs = new XMLSchemata ('test/soap.xsd')
459
+
460
+ console.log (xs)
461
+
462
+ console.log (xs.stringify ({
463
+ Envelope: {
464
+ Body: {null: {'<foo>bar</foo>': {Id: 1}}},
465
+ }
466
+ }))
467
+
468
+ }
469
+
470
+
456
471
  async function main () {
457
472
 
458
473
  // await test_001_lexer_sync ('E05a.xml')
@@ -472,7 +487,7 @@ async function main () {
472
487
  // await test_006_schemata ()
473
488
  // await test_007_wsdl ()
474
489
  // await test_008_schemata ()
475
- test_009_schemata ('smev-message-exchange-service-1.1.xsd')
490
+ // test_009_schemata ('smev-message-exchange-service-1.1.xsd')
476
491
  // test_009_schemata ('sign.xsd')
477
492
 
478
493
  // test_010_node ()
@@ -481,6 +496,8 @@ async function main () {
481
496
 
482
497
  // test_012_parser ('param_types.xml')
483
498
  // test_012_parser ('20040.wsdl')
499
+
500
+ test_013_soap ()
484
501
 
485
502
  }
486
503