xml-toolkit 1.0.55 → 1.0.57
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 +1 -1
- package/lib/XMLSchemata.js +6 -0
- package/package.json +1 -1
package/lib/XMLMarshaller.js
CHANGED
|
@@ -111,7 +111,7 @@ const XMLMarshaller = class {
|
|
|
111
111
|
|
|
112
112
|
if (data [XSI_TYPE]) {
|
|
113
113
|
let d = {}; for (let k in data) d [k] = data [k]
|
|
114
|
-
this.
|
|
114
|
+
this.appendContent (this.schema.getType (data [XSI_TYPE]), d)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (type) return this.appendContent (this.xs.getType (type), data)
|
package/lib/XMLSchemata.js
CHANGED
|
@@ -27,6 +27,8 @@ const XMLSchemata = class extends Map {
|
|
|
27
27
|
new XMLSchemaXml (this)
|
|
28
28
|
new XMLSchemaBuiltIn (this)
|
|
29
29
|
|
|
30
|
+
this.loadedFiles = new Set()
|
|
31
|
+
|
|
30
32
|
this.addFile (fn)
|
|
31
33
|
|
|
32
34
|
}
|
|
@@ -159,6 +161,10 @@ const XMLSchemata = class extends Map {
|
|
|
159
161
|
|
|
160
162
|
addFile (fn, options = {}) {
|
|
161
163
|
|
|
164
|
+
if (this.loadedFiles.has (fn)) return
|
|
165
|
+
|
|
166
|
+
this.loadedFiles.add (fn)
|
|
167
|
+
|
|
162
168
|
options.dirname = path.dirname (fn)
|
|
163
169
|
|
|
164
170
|
const document = this.parser.process (fs.readFileSync (fn, 'utf-8'))
|