0

I used getPrettyFormat() in Jdom2 and it gives me a XML file as below.

<startDate>2016-05-27</startDate>

<endDate>2021-05-27</endDate>

<enrollBeginDate>2016-05-27</enrollBeginDate>

<enrollEndDate>2016-05-27</enrollEndDate>

But I need to remove the additional new line between tags. So the output should like below;

<startDate>2016-05-27</startDate>
<endDate>2021-05-27</endDate>
<enrollBeginDate>2016-05-27</enrollBeginDate>
<enrollEndDate>2016-05-27</enrollEndDate>

My code;

Document xmlMessage = new Document(eleCourse);
XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.setFormat(Format.getPrettyFormat().setOmitDeclaration(true).set);
return xmlOutput.outputString(xmlMessage);

Please help.

Madhawas
  • 371
  • 1
  • 2
  • 15

0 Answers0