Open assaad97 opened 3 years ago
I have the same question
If the object has only one key, it will be used as the root, otherwise, a root node will be created. See:
https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/src/builder.coffee#L34
Not sure if it helps, but in my case I had
builder.buildObject({'foo': {$: {myAttr: 'myValue'}}, bar: 'bar', baz: 'baz'})
'<root><foo myAttr="myValue"/><bar>bar</bar><baz>baz</baz></root>'
When what I really wanted was
builder.buildObject({'foo': {$: {myAttr: 'myValue'}, bar: 'bar', baz: 'baz'}})
'<foo myAttr="myValue"><bar>bar</bar><baz>baz</baz></foo>'
Maybe your XML structure can have more than one parent element. Example `
`
You have to be only one "parent element" Like this... `
`
hi, im converting a json object to a xml file, using builder class, and i want to deny the root node, meaning, to convert the json object to an xml without adding the root node, i tried the option explicitRoot to false and true without any change, if anyone knows how to do it, i would appreciate the help