Поправлен баг в fromObject
This commit is contained in:
@@ -734,8 +734,8 @@ class XmlParser extends NodeBase {
|
|||||||
} else if (tag === '*ATTRS') {
|
} else if (tag === '*ATTRS') {
|
||||||
//пропускаем
|
//пропускаем
|
||||||
} else {
|
} else {
|
||||||
if (typeof(objNode) === 'string') {
|
if (typeof(objNode) === 'string' || typeof(objNode) === 'number') {
|
||||||
result.push(this.createNode(tag, null, [this.createText(objNode).raw]).raw);
|
result.push(this.createNode(tag, null, [this.createText(objNode.toString()).raw]).raw);
|
||||||
} else if (Array.isArray(objNode)) {
|
} else if (Array.isArray(objNode)) {
|
||||||
for (const n of objNode) {
|
for (const n of objNode) {
|
||||||
if (typeof(n) === 'string') {
|
if (typeof(n) === 'string') {
|
||||||
@@ -747,6 +747,8 @@ class XmlParser extends NodeBase {
|
|||||||
|
|
||||||
} else if (typeof(objNode) === 'object') {
|
} else if (typeof(objNode) === 'object') {
|
||||||
result.push(this.createNode(tag, (objNode['*ATTRS'] ? Object.entries(objNode['*ATTRS']) : null), objectToNodes(objNode)).raw);
|
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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user