java - Xerces setTextContent method strips new lines / carriage returns. How to prevent? -
i'm using xerces (java) generate xml documents. have large block of text (including carriage returns , new lines) replicate in xml document text content of element. example:
<element>this text here more that's folks</element>
however, whenever try use:
element.settextcontent(myblockoftext)
all new lines replaced single space characters.
how can keep new lines within block of text using xerces? (tried cdata, it's quoting xml (left angle brackets etc) within xml itself).
do have control of document? if so, might try xml:space attribute. see http://www.w3.org/tr/xml/#sec-white-space , http://codeidol.com/java/java-xml-for-web/generating-and-serializing-xml-documents/handling-whitespace/
Comments
Post a Comment