You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Cannot convert an object with text array ('#'=[]) to XML
To Reproduce
In your documentation you have the following mixed content example
obj2 = { monologue: {
'#': [
'Talk to me Goose!',
{ 'cut': 'dog tag shot' },
'Talk to me...'
]
} }
Attempting to convert it to XML with the following throws an exception:
const doc = xmlBuilder.create().ele(obj2 );
console.log(doc.end({ prettyPrint: true }));
This example throws and exception:
UnhandledPromiseRejectionWarning: InvalidCharacterError: The string contains invalid characters. Invalid XML name: 0
at InvalidCharacterError.DOMException [as constructor] (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\dom\DOMException.js:28:28)
at new InvalidCharacterError (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\dom\DOMException.js:342:23)
at namespace_validate (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\algorithm\NamespaceAlgorithm.js:18:15)
at Object.namespace_extractQName (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\algorithm\NamespaceAlgorithm.js:78:5)
at XMLBuilderImpl.ele (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\builder\XMLBuilderImpl.js:109:41)
at ObjectReader.BaseReader._element (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\BaseReader.js:35:50)
at ObjectReader.BaseReader.element (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\BaseReader.js:113:21)
at ObjectReader. (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\ObjectReader.js:144:40)
at Object.forEachObject (C:\development\node\XMLMapper\node_modules@oozcitak\util\lib\index.js:106:26)
at ObjectReader._parse (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\ObjectReader.js:46:20)
Expected behavior
XML: <monologue> Talk to me Goose! <cut>dog tag shot</cut> Talk to me... </monologue>
Version:
node.js: [v14.17.0]
xmlbuilder2 [2.4.1]
The text was updated successfully, but these errors were encountered:
Describe the bug
Cannot convert an object with text array ('#'=[]) to XML
To Reproduce
In your documentation you have the following mixed content example
obj2 = { monologue: {
'#': [
'Talk to me Goose!',
{ 'cut': 'dog tag shot' },
'Talk to me...'
]
} }
Attempting to convert it to XML with the following throws an exception:
const doc = xmlBuilder.create().ele(obj2 );
console.log(doc.end({ prettyPrint: true }));
This example throws and exception:
UnhandledPromiseRejectionWarning: InvalidCharacterError: The string contains invalid characters. Invalid XML name: 0
at InvalidCharacterError.DOMException [as constructor] (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\dom\DOMException.js:28:28)
at new InvalidCharacterError (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\dom\DOMException.js:342:23)
at namespace_validate (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\algorithm\NamespaceAlgorithm.js:18:15)
at Object.namespace_extractQName (C:\development\node\XMLMapper\node_modules@oozcitak\dom\lib\algorithm\NamespaceAlgorithm.js:78:5)
at XMLBuilderImpl.ele (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\builder\XMLBuilderImpl.js:109:41)
at ObjectReader.BaseReader._element (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\BaseReader.js:35:50)
at ObjectReader.BaseReader.element (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\BaseReader.js:113:21)
at ObjectReader. (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\ObjectReader.js:144:40)
at Object.forEachObject (C:\development\node\XMLMapper\node_modules@oozcitak\util\lib\index.js:106:26)
at ObjectReader._parse (C:\development\node\XMLMapper\node_modules\xmlbuilder2\lib\readers\ObjectReader.js:46:20)
Expected behavior
XML:
<monologue> Talk to me Goose! <cut>dog tag shot</cut> Talk to me... </monologue>
Version:
The text was updated successfully, but these errors were encountered: