I want to write text containing white space characters, such as newline and tab , in an xml file, so I use
Element element = xmldoc.createElement("TestElement"); element.appendChild(xmldoc.createCDATASection(somestring));
but when i read it again when using
Node vs = xmldoc.getElementsByTagName("TestElement").item(0); String x = vs.getFirstChild().getNodeValue();
I get a row that no longer has rows. When I look directly in xml on disk, newline characters seem to be saved. therefore, the problem occurs when reading in an XML file.
How to save newlines?
Thanks!
java xml w3c cdata newline
clamp
source share