I am using xmlBuilder library in Nodejs to create XML from prepared corresponding JSON.
I am creating JSON structure first and then convert it to XML. Javascript is the coding language.
It is required to create following XML structure.
<A>TestA</A>
<B>TestB</B>
<C>TestC1</C>
<C>TestC2</C>
<D>TestD</D>
Because of the repeated tags (tag C), I am unable to do it. Kindly suggest solutions!
{
A: TestA,
B: TestB,
C: // unclear here
D: TestD
}
In XSLT 3.0 (for example with Saxon-JS) you could transform this JSON:
to this XML:
with the logic:
It's a little more work to transform between JSON and XML using XSLT 3.0 than with some conversion libraries, but the advantage is it gives you total control over the output.