You have to use following step to create an XML document using JDOM.
Just open text editor and save following code in that.
Code:
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
Step 2
Now start with new Java class DoctoJDOM with new XML Documents using the JDOM libraries.
Code:
public class DoctoJDOM { }
Step 3
Now Define JDOMDoc() method that will create a new XML document using the JDOM library. You can do this by typing the following code after the { bracket in the class definition.
Code:
public Document JDOMDoc() throws Exception
{
Document JDOMDocs = new Document(new Element("kyuntry"));
myJDOMDoc.getRootElement().
addContent(new Element("Wlouinyt").
addContent(new Element("sdsvzc").
setText("bvgdbd")).
addContent(new Element("xbdfdd").
setText("dfbd")));
return JDOMDocs;
}
Bookmarks