I have a java code which writes the output to an XML by using DOM parsing strategy. The contents of the XML after writing it are as follows
<L-1><?xm-replace_text {L-1}?></L-1>
Now if I rewrite the same XML after making some changes, the contents of XML after writing will be as follows
<L-1>
<?xm-replace_text {L-1}?>
</L-1>
I am using the same transformer every time I write the XML as
encoding = (doc.getXmlEncoding() != null) ? doc.getXmlEncoding()
: "iso-8859-1";
version = (doc.getXmlVersion() != null) ? doc.getXmlVersion()
: "1.0";
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
transformer.setOutputProperty(OutputKeys.VERSION, version);
Why do I have the indentation problem ?