I used getPrettyFormat() in Jdom2 and it gives me a XML file as below.
<?xml version="1.0" encoding="UTF-8"?>
<courses>
<name id="1">CynO</name>
</courses>
My XML file generate 5 lines instead of 4. How to delete the fifth empty line?
My code:
XMLOutputter xml = new XMLOutputter();
xml.setFormat(Format.getPrettyFormat());
xml.output(doc, new FileWriter(fileName));