I tried the following, but the conversion from json to xml string was messy.
var innerStr = '<circle cx="10" cy="10" r="10" />
<rect x="0" y="0" width="10" height="10"/>';
var result = x2js.json2xml_str({
g: {
_myAttrib: 'fixed',
__text: innerStr
}
});
// only prints "<circle cx="10" cy="10" r="10"></circle>" instead of the complete xml string
console.log(result);
Thanks for providing this project. I'm trying to add more content to a xml node using javascript, but I do not see how to do it.
For example, I already have this:
But I want to add an arbitrary children, and I do not know what those children will be. They might be:
And the result needs to be:
I tried the following, but the conversion from json to xml string was messy.