I'm using Xerces (Java) to generate XML documents. I have a large block of text (including carriage returns and new lines) that I would like to replicate exactly in my XML document as the text content of an element. For example:
<element>This is some text
here is some more
that's all folks</element>
However, whenever I try use:
element.setTextContent(myBlockOfText)
All the new lines are replaced with single space characters.
How can I keep the new lines within this block of text using Xerces? (Tried CDATA, but it's really only for quoting XML (left angle brackets etc) within XML itself).