node-opcua-xml2json 2.64.1 → 2.68.0
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/dist/source/definition_parser.d.ts +3 -3
- package/dist/source/definition_parser.js +83 -83
- package/dist/source/extension_object_parser.d.ts +24 -17
- package/dist/source/extension_object_parser.js +249 -239
- package/dist/source/extension_object_parser.js.map +1 -1
- package/dist/source/fragment_cloner.d.ts +13 -13
- package/dist/source/fragment_cloner.js +44 -44
- package/dist/source/fragment_cloner_parser.d.ts +8 -8
- package/dist/source/fragment_cloner_parser.js +15 -15
- package/dist/source/index.d.ts +6 -6
- package/dist/source/index.js +22 -18
- package/dist/source/index.js.map +1 -1
- package/dist/source/nodejs/xml2json_fs.d.ts +10 -10
- package/dist/source/nodejs/xml2json_fs.js +38 -38
- package/dist/source/xml2Json_pojo_tools.d.ts +19 -19
- package/dist/source/xml2Json_pojo_tools.js +88 -88
- package/dist/source/xml2json.d.ts +179 -177
- package/dist/source/xml2json.js +302 -295
- package/dist/source/xml2json.js.map +1 -1
- package/dist/source/xml2json_pojo.d.ts +7 -7
- package/dist/source/xml2json_pojo.js +28 -28
- package/package.json +7 -7
- package/source/extension_object_parser.ts +10 -0
- package/source/xml2json.ts +10 -1
- package/dist/source/fragmentCloner.d.ts +0 -20
- package/dist/source/fragmentCloner.js +0 -55
- package/dist/source/fragmentCloner.js.map +0 -1
- package/dist/source/xml2JsonPojo.d.ts +0 -8
- package/dist/source/xml2JsonPojo.js +0 -109
- package/dist/source/xml2JsonPojo.js.map +0 -1
package/dist/source/xml2json.js
CHANGED
|
@@ -1,296 +1,303 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module node-opcua-xml2json
|
|
4
|
-
* node -> see if https://github.com/isaacs/sax-js could be used instead
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.Xml2Json = exports.ReaderState = exports.ReaderStateBase = void 0;
|
|
8
|
-
// tslint:disable:max-classes-per-file
|
|
9
|
-
// tslint:disable:no-var-requires
|
|
10
|
-
// tslint:disable:unified-signatures
|
|
11
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
12
|
-
const LtxParser = require("ltx/lib/parsers/ltx.js");
|
|
13
|
-
/**
|
|
14
|
-
* @static
|
|
15
|
-
* @private
|
|
16
|
-
* @method _coerceParser
|
|
17
|
-
* @param parser {map<ReaderState|options>}
|
|
18
|
-
* @return {map}
|
|
19
|
-
*/
|
|
20
|
-
function _coerceParser(parser) {
|
|
21
|
-
for (const name of Object.keys(parser)) {
|
|
22
|
-
if (parser[name] && !(parser[name] instanceof ReaderState)) {
|
|
23
|
-
// this is to prevent recursion
|
|
24
|
-
const tmp = parser[name];
|
|
25
|
-
delete parser[name];
|
|
26
|
-
parser[name] = new ReaderState(tmp);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return parser;
|
|
30
|
-
}
|
|
31
|
-
class ReaderStateBase {
|
|
32
|
-
}
|
|
33
|
-
exports.ReaderStateBase = ReaderStateBase;
|
|
34
|
-
/**
|
|
35
|
-
* @class ReaderState
|
|
36
|
-
* @private
|
|
37
|
-
* @param options
|
|
38
|
-
* @param [options.parser=null] {map<ReaderState|options}}
|
|
39
|
-
* @param [options.init|null]
|
|
40
|
-
* @param [options.finish]
|
|
41
|
-
* @param [options.startElement]
|
|
42
|
-
* @param [options.endElement]
|
|
43
|
-
*/
|
|
44
|
-
class ReaderState extends ReaderStateBase {
|
|
45
|
-
constructor(options) {
|
|
46
|
-
super();
|
|
47
|
-
this.chunks = [];
|
|
48
|
-
this.text = "";
|
|
49
|
-
this.name = "";
|
|
50
|
-
this.level = -1;
|
|
51
|
-
this.currentLevel = -1;
|
|
52
|
-
// ensure options object has only expected properties
|
|
53
|
-
options.parser = options.parser || {};
|
|
54
|
-
if (!(options instanceof ReaderStateBase)) {
|
|
55
|
-
this._init = options.init;
|
|
56
|
-
this._finish = options.finish;
|
|
57
|
-
this._startElement = options.startElement;
|
|
58
|
-
this._endElement = options.endElement;
|
|
59
|
-
}
|
|
60
|
-
this.parser = _coerceParser(options.parser);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* @method _on_init
|
|
64
|
-
* @param elementName - the name of the element
|
|
65
|
-
* @param attrs
|
|
66
|
-
* @param parent
|
|
67
|
-
* @param level
|
|
68
|
-
* @param engine
|
|
69
|
-
* @protected
|
|
70
|
-
*/
|
|
71
|
-
_on_init(elementName, attrs, parent, level, engine) {
|
|
72
|
-
this.name = elementName;
|
|
73
|
-
this.parent = parent;
|
|
74
|
-
this.engine = engine;
|
|
75
|
-
this.data = {};
|
|
76
|
-
this.level = level;
|
|
77
|
-
this.currentLevel = this.level;
|
|
78
|
-
this.attrs = attrs;
|
|
79
|
-
(0, node_opcua_assert_1.assert)(this.attrs);
|
|
80
|
-
if (this._init) {
|
|
81
|
-
this._init(elementName, attrs, parent, engine);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
_on_finish() {
|
|
85
|
-
if (this._finish) {
|
|
86
|
-
this._finish();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* @param level
|
|
91
|
-
* @param elementName - the name of the element
|
|
92
|
-
* @param attrs
|
|
93
|
-
* @protected
|
|
94
|
-
*/
|
|
95
|
-
_on_startElement(level, elementName, attrs) {
|
|
96
|
-
this.currentLevel = level;
|
|
97
|
-
// console.log("wxxxx _on_startElement#" + this.name, elementName, this.currentLevel);
|
|
98
|
-
this.chunks = [];
|
|
99
|
-
this.text = "";
|
|
100
|
-
if (this._startElement) {
|
|
101
|
-
this._startElement(elementName, attrs);
|
|
102
|
-
}
|
|
103
|
-
if (this.engine && Object.prototype.hasOwnProperty.call(this.parser, elementName)) {
|
|
104
|
-
// console.log("promoting ", elementName, this.level);
|
|
105
|
-
this.engine._promote(this.parser[elementName], level, elementName, attrs);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
_on_endElement2(level, elementName) {
|
|
109
|
-
if (this._endElement) {
|
|
110
|
-
this._endElement(elementName);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @method _on_endElement
|
|
115
|
-
* @protected
|
|
116
|
-
*/
|
|
117
|
-
_on_endElement(level, elementName) {
|
|
118
|
-
// console.log("wxxxx _on_endElement#" + this.name, elementName, level, this.currentLevel);
|
|
119
|
-
(0, node_opcua_assert_1.assert)(this.attrs);
|
|
120
|
-
this.chunks = this.chunks || [];
|
|
121
|
-
if (this.level > level) {
|
|
122
|
-
// we end a child element of this node
|
|
123
|
-
this._on_endElement2(level, elementName);
|
|
124
|
-
}
|
|
125
|
-
else if (this.level === level) {
|
|
126
|
-
// we received the end event of this node
|
|
127
|
-
// we need to finish
|
|
128
|
-
this.text = this.chunks.join("");
|
|
129
|
-
this.chunks = [];
|
|
130
|
-
// this is the end
|
|
131
|
-
this._on_finish();
|
|
132
|
-
if (this.parent &&
|
|
133
|
-
this.parent.parser &&
|
|
134
|
-
Object.prototype.hasOwnProperty.call(this.parent.parser, elementName)) {
|
|
135
|
-
// console.log("xxx demoting#" + this.name, elementName, this.level);
|
|
136
|
-
this.engine._demote(this, level, elementName);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* @method _on_text
|
|
142
|
-
* @param text {String} the text found inside the element
|
|
143
|
-
* @protected
|
|
144
|
-
*/
|
|
145
|
-
_on_text(text) {
|
|
146
|
-
this.chunks = this.chunks || [];
|
|
147
|
-
text = text.trim();
|
|
148
|
-
if (text.length === 0) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
this.chunks.push(text);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.ReaderState = ReaderState;
|
|
155
|
-
const regexp = /(([^:]+):)?(.*)/;
|
|
156
|
-
function resolve_namespace(name) {
|
|
157
|
-
const m = name.match(regexp);
|
|
158
|
-
if (!m) {
|
|
159
|
-
throw new Error("Invalid match");
|
|
160
|
-
}
|
|
161
|
-
return {
|
|
162
|
-
ns: m[2],
|
|
163
|
-
tag: m[3]
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* @class Xml2Json
|
|
168
|
-
* @param options - the state machine as a ReaderState node.
|
|
169
|
-
* @param [options.parser=null] {ReaderState}
|
|
170
|
-
* @param [options.init|null]
|
|
171
|
-
* @param [options.finish]
|
|
172
|
-
* @param [options.startElement]
|
|
173
|
-
* @param [options.endElement]
|
|
174
|
-
* @constructor
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* var parser = new Xml2Json({
|
|
178
|
-
* parser: {
|
|
179
|
-
* 'person': {
|
|
180
|
-
* init: function(name,attrs) {
|
|
181
|
-
* this.parent.root.obj = {};
|
|
182
|
-
* this.obj = this.parent.root.obj;
|
|
183
|
-
* this.obj['name'] = attrs['name'];
|
|
184
|
-
* },
|
|
185
|
-
* parser: {
|
|
186
|
-
* 'address': {
|
|
187
|
-
* finish: function(){
|
|
188
|
-
* this.parent.obj['address'] = this.text;
|
|
189
|
-
* }
|
|
190
|
-
* }
|
|
191
|
-
* }
|
|
192
|
-
* }
|
|
193
|
-
* }
|
|
194
|
-
* });
|
|
195
|
-
*
|
|
196
|
-
* var xml_string = "<employees>" +
|
|
197
|
-
* " <person name='John'>" +
|
|
198
|
-
* " <address>Paris</address>" +
|
|
199
|
-
* " </person>" +
|
|
200
|
-
* "</employees>";
|
|
201
|
-
*
|
|
202
|
-
* parser.parseString(xml_string, function() {
|
|
203
|
-
* parser.obj.should.eql({name: 'John',address: 'Paris'});
|
|
204
|
-
* done();
|
|
205
|
-
* });
|
|
206
|
-
*/
|
|
207
|
-
class Xml2Json {
|
|
208
|
-
constructor(options) {
|
|
209
|
-
this.currentLevel = 0;
|
|
210
|
-
this.state_stack = [];
|
|
211
|
-
this.current_state = null;
|
|
212
|
-
const state = options instanceof ReaderStateBase ? options : new ReaderState(options);
|
|
213
|
-
state.root = this;
|
|
214
|
-
this.state_stack = [];
|
|
215
|
-
this.current_state = null;
|
|
216
|
-
this._promote(state, 0);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
parser.
|
|
221
|
-
parser.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
this.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
parser.on("
|
|
265
|
-
const tag_ns = resolve_namespace(name);
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module node-opcua-xml2json
|
|
4
|
+
* node -> see if https://github.com/isaacs/sax-js could be used instead
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Xml2Json = exports.ReaderState = exports.ReaderStateBase = void 0;
|
|
8
|
+
// tslint:disable:max-classes-per-file
|
|
9
|
+
// tslint:disable:no-var-requires
|
|
10
|
+
// tslint:disable:unified-signatures
|
|
11
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
12
|
+
const LtxParser = require("ltx/lib/parsers/ltx.js");
|
|
13
|
+
/**
|
|
14
|
+
* @static
|
|
15
|
+
* @private
|
|
16
|
+
* @method _coerceParser
|
|
17
|
+
* @param parser {map<ReaderState|options>}
|
|
18
|
+
* @return {map}
|
|
19
|
+
*/
|
|
20
|
+
function _coerceParser(parser) {
|
|
21
|
+
for (const name of Object.keys(parser)) {
|
|
22
|
+
if (parser[name] && !(parser[name] instanceof ReaderState)) {
|
|
23
|
+
// this is to prevent recursion
|
|
24
|
+
const tmp = parser[name];
|
|
25
|
+
delete parser[name];
|
|
26
|
+
parser[name] = new ReaderState(tmp);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return parser;
|
|
30
|
+
}
|
|
31
|
+
class ReaderStateBase {
|
|
32
|
+
}
|
|
33
|
+
exports.ReaderStateBase = ReaderStateBase;
|
|
34
|
+
/**
|
|
35
|
+
* @class ReaderState
|
|
36
|
+
* @private
|
|
37
|
+
* @param options
|
|
38
|
+
* @param [options.parser=null] {map<ReaderState|options}}
|
|
39
|
+
* @param [options.init|null]
|
|
40
|
+
* @param [options.finish]
|
|
41
|
+
* @param [options.startElement]
|
|
42
|
+
* @param [options.endElement]
|
|
43
|
+
*/
|
|
44
|
+
class ReaderState extends ReaderStateBase {
|
|
45
|
+
constructor(options) {
|
|
46
|
+
super();
|
|
47
|
+
this.chunks = [];
|
|
48
|
+
this.text = "";
|
|
49
|
+
this.name = "";
|
|
50
|
+
this.level = -1;
|
|
51
|
+
this.currentLevel = -1;
|
|
52
|
+
// ensure options object has only expected properties
|
|
53
|
+
options.parser = options.parser || {};
|
|
54
|
+
if (!(options instanceof ReaderStateBase)) {
|
|
55
|
+
this._init = options.init;
|
|
56
|
+
this._finish = options.finish;
|
|
57
|
+
this._startElement = options.startElement;
|
|
58
|
+
this._endElement = options.endElement;
|
|
59
|
+
}
|
|
60
|
+
this.parser = _coerceParser(options.parser);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @method _on_init
|
|
64
|
+
* @param elementName - the name of the element
|
|
65
|
+
* @param attrs
|
|
66
|
+
* @param parent
|
|
67
|
+
* @param level
|
|
68
|
+
* @param engine
|
|
69
|
+
* @protected
|
|
70
|
+
*/
|
|
71
|
+
_on_init(elementName, attrs, parent, level, engine) {
|
|
72
|
+
this.name = elementName;
|
|
73
|
+
this.parent = parent;
|
|
74
|
+
this.engine = engine;
|
|
75
|
+
this.data = {};
|
|
76
|
+
this.level = level;
|
|
77
|
+
this.currentLevel = this.level;
|
|
78
|
+
this.attrs = attrs;
|
|
79
|
+
(0, node_opcua_assert_1.assert)(this.attrs);
|
|
80
|
+
if (this._init) {
|
|
81
|
+
this._init(elementName, attrs, parent, engine);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
_on_finish() {
|
|
85
|
+
if (this._finish) {
|
|
86
|
+
this._finish();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @param level
|
|
91
|
+
* @param elementName - the name of the element
|
|
92
|
+
* @param attrs
|
|
93
|
+
* @protected
|
|
94
|
+
*/
|
|
95
|
+
_on_startElement(level, elementName, attrs) {
|
|
96
|
+
this.currentLevel = level;
|
|
97
|
+
// console.log("wxxxx _on_startElement#" + this.name, elementName, this.currentLevel);
|
|
98
|
+
this.chunks = [];
|
|
99
|
+
this.text = "";
|
|
100
|
+
if (this._startElement) {
|
|
101
|
+
this._startElement(elementName, attrs);
|
|
102
|
+
}
|
|
103
|
+
if (this.engine && Object.prototype.hasOwnProperty.call(this.parser, elementName)) {
|
|
104
|
+
// console.log("promoting ", elementName, this.level);
|
|
105
|
+
this.engine._promote(this.parser[elementName], level, elementName, attrs);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
_on_endElement2(level, elementName) {
|
|
109
|
+
if (this._endElement) {
|
|
110
|
+
this._endElement(elementName);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @method _on_endElement
|
|
115
|
+
* @protected
|
|
116
|
+
*/
|
|
117
|
+
_on_endElement(level, elementName) {
|
|
118
|
+
// console.log("wxxxx _on_endElement#" + this.name, elementName, level, this.currentLevel);
|
|
119
|
+
(0, node_opcua_assert_1.assert)(this.attrs);
|
|
120
|
+
this.chunks = this.chunks || [];
|
|
121
|
+
if (this.level > level) {
|
|
122
|
+
// we end a child element of this node
|
|
123
|
+
this._on_endElement2(level, elementName);
|
|
124
|
+
}
|
|
125
|
+
else if (this.level === level) {
|
|
126
|
+
// we received the end event of this node
|
|
127
|
+
// we need to finish
|
|
128
|
+
this.text = this.chunks.join("");
|
|
129
|
+
this.chunks = [];
|
|
130
|
+
// this is the end
|
|
131
|
+
this._on_finish();
|
|
132
|
+
if (this.parent &&
|
|
133
|
+
this.parent.parser &&
|
|
134
|
+
Object.prototype.hasOwnProperty.call(this.parent.parser, elementName)) {
|
|
135
|
+
// console.log("xxx demoting#" + this.name, elementName, this.level);
|
|
136
|
+
this.engine._demote(this, level, elementName);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* @method _on_text
|
|
142
|
+
* @param text {String} the text found inside the element
|
|
143
|
+
* @protected
|
|
144
|
+
*/
|
|
145
|
+
_on_text(text) {
|
|
146
|
+
this.chunks = this.chunks || [];
|
|
147
|
+
text = text.trim();
|
|
148
|
+
if (text.length === 0) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this.chunks.push(text);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.ReaderState = ReaderState;
|
|
155
|
+
const regexp = /(([^:]+):)?(.*)/;
|
|
156
|
+
function resolve_namespace(name) {
|
|
157
|
+
const m = name.match(regexp);
|
|
158
|
+
if (!m) {
|
|
159
|
+
throw new Error("Invalid match");
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
ns: m[2],
|
|
163
|
+
tag: m[3]
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @class Xml2Json
|
|
168
|
+
* @param options - the state machine as a ReaderState node.
|
|
169
|
+
* @param [options.parser=null] {ReaderState}
|
|
170
|
+
* @param [options.init|null]
|
|
171
|
+
* @param [options.finish]
|
|
172
|
+
* @param [options.startElement]
|
|
173
|
+
* @param [options.endElement]
|
|
174
|
+
* @constructor
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* var parser = new Xml2Json({
|
|
178
|
+
* parser: {
|
|
179
|
+
* 'person': {
|
|
180
|
+
* init: function(name,attrs) {
|
|
181
|
+
* this.parent.root.obj = {};
|
|
182
|
+
* this.obj = this.parent.root.obj;
|
|
183
|
+
* this.obj['name'] = attrs['name'];
|
|
184
|
+
* },
|
|
185
|
+
* parser: {
|
|
186
|
+
* 'address': {
|
|
187
|
+
* finish: function(){
|
|
188
|
+
* this.parent.obj['address'] = this.text;
|
|
189
|
+
* }
|
|
190
|
+
* }
|
|
191
|
+
* }
|
|
192
|
+
* }
|
|
193
|
+
* }
|
|
194
|
+
* });
|
|
195
|
+
*
|
|
196
|
+
* var xml_string = "<employees>" +
|
|
197
|
+
* " <person name='John'>" +
|
|
198
|
+
* " <address>Paris</address>" +
|
|
199
|
+
* " </person>" +
|
|
200
|
+
* "</employees>";
|
|
201
|
+
*
|
|
202
|
+
* parser.parseString(xml_string, function() {
|
|
203
|
+
* parser.obj.should.eql({name: 'John',address: 'Paris'});
|
|
204
|
+
* done();
|
|
205
|
+
* });
|
|
206
|
+
*/
|
|
207
|
+
class Xml2Json {
|
|
208
|
+
constructor(options) {
|
|
209
|
+
this.currentLevel = 0;
|
|
210
|
+
this.state_stack = [];
|
|
211
|
+
this.current_state = null;
|
|
212
|
+
const state = options instanceof ReaderStateBase ? options : new ReaderState(options);
|
|
213
|
+
state.root = this;
|
|
214
|
+
this.state_stack = [];
|
|
215
|
+
this.current_state = null;
|
|
216
|
+
this._promote(state, 0);
|
|
217
|
+
}
|
|
218
|
+
parseStringSync(xml_text) {
|
|
219
|
+
let retValue = {};
|
|
220
|
+
const parser = this._prepareParser((err, r) => retValue = r);
|
|
221
|
+
parser.write(xml_text);
|
|
222
|
+
parser.end();
|
|
223
|
+
return retValue;
|
|
224
|
+
}
|
|
225
|
+
parseString(xml_text, callback) {
|
|
226
|
+
const parser = this._prepareParser(callback);
|
|
227
|
+
parser.write(xml_text);
|
|
228
|
+
parser.end();
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @param new_state
|
|
232
|
+
* @param name
|
|
233
|
+
* @param attr
|
|
234
|
+
* @private
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
_promote(new_state, level, name, attr) {
|
|
238
|
+
attr = attr || {};
|
|
239
|
+
this.state_stack.push({
|
|
240
|
+
backup: {},
|
|
241
|
+
state: this.current_state
|
|
242
|
+
});
|
|
243
|
+
const parent = this.current_state;
|
|
244
|
+
this.current_state = new_state;
|
|
245
|
+
this.current_state._on_init(name || "???", attr, parent, level, this);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @private
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
_demote(cur_state, level, elementName) {
|
|
253
|
+
/// assert(this.current_state === cur_state);
|
|
254
|
+
const { state, backup } = this.state_stack.pop();
|
|
255
|
+
this.current_state = state;
|
|
256
|
+
if (this.current_state) {
|
|
257
|
+
this.current_state._on_endElement2(level, elementName);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
_prepareParser(callback) {
|
|
261
|
+
(0, node_opcua_assert_1.assert)(typeof callback === 'function');
|
|
262
|
+
const parser = new LtxParser();
|
|
263
|
+
this.currentLevel = 0;
|
|
264
|
+
parser.on("startElement", (name, attrs) => {
|
|
265
|
+
const tag_ns = resolve_namespace(name);
|
|
266
|
+
this.currentLevel += 1;
|
|
267
|
+
if (this.current_state) {
|
|
268
|
+
this.current_state._on_startElement(this.currentLevel, tag_ns.tag, attrs);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
parser.on("endElement", (name) => {
|
|
272
|
+
const tag_ns = resolve_namespace(name);
|
|
273
|
+
if (this.current_state) {
|
|
274
|
+
this.current_state._on_endElement(this.currentLevel, tag_ns.tag);
|
|
275
|
+
}
|
|
276
|
+
this.currentLevel -= 1;
|
|
277
|
+
if (this.currentLevel === 0) {
|
|
278
|
+
parser.emit("close");
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
parser.on("text", (text) => {
|
|
282
|
+
text = text.trim();
|
|
283
|
+
if (text.length === 0) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (this.current_state) {
|
|
287
|
+
this.current_state._on_text(text);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
parser.once("close", () => {
|
|
291
|
+
if (callback) {
|
|
292
|
+
callback(null, this.current_state._pojo);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
return parser;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
exports.Xml2Json = Xml2Json;
|
|
299
|
+
// tslint:disable:no-var-requires
|
|
300
|
+
const thenify = require("thenify");
|
|
301
|
+
const opts = { multiArgs: false };
|
|
302
|
+
Xml2Json.prototype.parseString = thenify.withCallback(Xml2Json.prototype.parseString, opts);
|
|
296
303
|
//# sourceMappingURL=xml2json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml2json.js","sourceRoot":"","sources":["../../source/xml2json.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sCAAsC;AACtC,iCAAiC;AACjC,oCAAoC;AA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iC;AACjC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,MAAM,IAAI,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAClC,QAAQ,CAAC,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReaderState, ReaderStateParser, Xml2Json, XmlAttributes } from "./xml2json";
|
|
2
|
-
import { withPojoLambda } from "./xml2Json_pojo_tools";
|
|
3
|
-
export declare const json_parser: ReaderStateParser;
|
|
4
|
-
export declare function startPojo(pThis: ReaderState, elementName: string, attrs: XmlAttributes, withPojo: withPojoLambda): void;
|
|
5
|
-
export declare class Xml2JsonPojo extends Xml2Json {
|
|
6
|
-
constructor();
|
|
7
|
-
}
|
|
1
|
+
import { ReaderState, ReaderStateParser, Xml2Json, XmlAttributes } from "./xml2json";
|
|
2
|
+
import { withPojoLambda } from "./xml2Json_pojo_tools";
|
|
3
|
+
export declare const json_parser: ReaderStateParser;
|
|
4
|
+
export declare function startPojo(pThis: ReaderState, elementName: string, attrs: XmlAttributes, withPojo: withPojoLambda): void;
|
|
5
|
+
export declare class Xml2JsonPojo extends Xml2Json {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|