[jdom-interest] Getting xml header for every input into xml file

Mukunda hsmukunda at walla.com
Wed Oct 25 21:08:29 PDT 2006


       Hi 
       I am new to JDOM and I am getting xml headers for every input into
xml file. I am inputting name and age into xml file through java swings.
Below is the code that writes the data into xml file, I tried many ways, but
still getting xml headers for every input and 
could you also please tell me how to check duplicate data while entering
data into xml document. thanks.




        Element ele= new Element("root");
        Element name=new Element(jLabel1.getText().trim());
        Element age= new Element(jLabel2.getText().trim());
        ele.addContent(name);
        ele.addContent(s1);
        ele.addContent(age);
        ele.addContent(s2);
        Document doc=new Document(ele);
        FileOutputStream fout = new FileOutputStream("nameage.xml", true);
        XMLOutputter xmlout = new XMLOutputter();
        xmlout.output(doc,fout);
        fout.flush();
-- 
View this message in context: http://www.nabble.com/Getting-xml-header-for-every-input-into-xml-file-tf2511764.html#a7004892
Sent from the JDOM - General mailing list archive at Nabble.com.



More information about the jdom-interest mailing list