xml-toolkit 1.0.51 → 1.0.53
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/XMLMarshaller.js +12 -1
- package/lib/XMLNode.js +1 -1
- package/lib/XMLSchemata.js +1 -1
- package/package.json +1 -1
package/lib/XMLMarshaller.js
CHANGED
|
@@ -36,7 +36,18 @@ const XMLMarshaller = class {
|
|
|
36
36
|
|
|
37
37
|
printer.reset ()
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
try {
|
|
40
|
+
|
|
41
|
+
this.appendElement (schemaElement, data, this.ns.QName (o.localName || attributes.name, targetNamespace))
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
catch (cause) {
|
|
45
|
+
|
|
46
|
+
const {targetNamespace, attributes: {name}} = schemaElement
|
|
47
|
+
|
|
48
|
+
throw Error (`Cannot stringify ${JSON.stringify (data)} as ${name}#{${targetNamespace}}`, {cause})
|
|
49
|
+
|
|
50
|
+
}
|
|
40
51
|
|
|
41
52
|
return printer.text
|
|
42
53
|
|
package/lib/XMLNode.js
CHANGED
|
@@ -186,7 +186,7 @@ const XMLNode = class extends SAXEvent {
|
|
|
186
186
|
|
|
187
187
|
get innerText () {
|
|
188
188
|
|
|
189
|
-
const {children} = this; if (!Array.isArray (children) || children.length === 0) return this.text
|
|
189
|
+
const {children} = this; if (!Array.isArray (children) || children.length === 0) return this [TYPE] === SAXEvent.TYPES.END_ELEMENT ? '' : this.text
|
|
190
190
|
|
|
191
191
|
let s = ''; for (const child of children) s += child.innerText; return s
|
|
192
192
|
|
package/lib/XMLSchemata.js
CHANGED
|
@@ -63,7 +63,7 @@ const XMLSchemata = class extends Map {
|
|
|
63
63
|
|
|
64
64
|
getSimpleTypeClass (node) {
|
|
65
65
|
|
|
66
|
-
for (const {localName, namespaceURI, attributes: {base}, children} of node.children)
|
|
66
|
+
if (node) for (const {localName, namespaceURI, attributes: {base}, children} of node.children)
|
|
67
67
|
|
|
68
68
|
if (localName === 'restriction' && namespaceURI === XMLSchema.namespaceURI)
|
|
69
69
|
|