Can xml2js generate multiple text nodes under one parent?

Viewed 97

I'm trying to generate XML containing structures similar to the following:

<p>
  Some text ...
  <bold>Bold text</bold>
  ... some more text ...
  <italic>Italic text</italic>
  ... and yet more text.
</p>

What input to new xml2js.Builder().buildObject() will obtain this structure?

Note that the children of the p element are a mix of element nodes and text nodes, and occur in a specific order.

Background: This is JATS, not HTML. I'm modifying some existing code that produces XML for Crossref, and I have to add portions of JATS to the tree, a bit like this. If xml2js simply can't produce these structures I will seek another tool, but that would require a substantial refactoring, which I'd prefer to avoid.

0 Answers
Related