How to create an XML document using JDOM?
In this small program you can see how to use JDOM to create a simple xml file. Below you'll see how to create elements of the xml document, set some text for the element.
After that you can see how to use the
XMLOutputter class to write the JDOM document into file and display it on the screen. To make the output better we can apply a
Format to our xml document.
This program will output the following XML document:
<?xml version="1.0" encoding="UTF-8"?>