From 772ea3ca0c2fe985859ebd17642493bc59eb9331 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Fri, 2 Dec 2022 16:52:48 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D0=B2=20fromObject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/core/xml/XmlParser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/core/xml/XmlParser.js b/server/core/xml/XmlParser.js index 2c073c6..ae1b4f4 100644 --- a/server/core/xml/XmlParser.js +++ b/server/core/xml/XmlParser.js @@ -734,8 +734,8 @@ class XmlParser extends NodeBase { } else if (tag === '*ATTRS') { //пропускаем } else { - if (typeof(objNode) === 'string') { - result.push(this.createNode(tag, null, [this.createText(objNode).raw]).raw); + if (typeof(objNode) === 'string' || typeof(objNode) === 'number') { + result.push(this.createNode(tag, null, [this.createText(objNode.toString()).raw]).raw); } else if (Array.isArray(objNode)) { for (const n of objNode) { if (typeof(n) === 'string') { @@ -747,6 +747,8 @@ class XmlParser extends NodeBase { } else if (typeof(objNode) === 'object') { result.push(this.createNode(tag, (objNode['*ATTRS'] ? Object.entries(objNode['*ATTRS']) : null), objectToNodes(objNode)).raw); + } else { + throw new Error(`Unknown node type "${typeof(objNode)}" of node: ${objNode}`); } } }