Java and XML

I want to store my java conatains to XML file so that I can send this xmls to generate PDF file.plz suggest me the best approach and the liberary to use
[166 byte] By [Jmaes@javaa] at [2007-11-27 5:11:44]
# 1
You can use JDomfor more details go to http://www.jdom.org/and one more thing you posted this topic in wrong placethanks
shinde_yogesha at 2007-7-12 10:32:13 > top of Java-index,Desktop,Core GUI APIs...
# 2
Thats ok, but its more helpfull if you provide some codeor example.
Jmaes@javaa at 2007-7-12 10:32:13 > top of Java-index,Desktop,Core GUI APIs...
# 3

k....

Document doc = builder.build("Base.hbm.xml");

Element ele_temp = doc.getRootElement();

Element ele = (Element)ele_temp.clone();

Document doc_crea = new Document();

/*<id name="id" column="id" type="long">

<generator class="native" />

</id>

<property name="fname" column="FILENAME" type="string" />

<property name="type" column="FILE_TYPE" type="string" />*/

// Fetching table Name

String tableName = "anyname";

// Converting table name to Class Name

String className = "nayname";

// Fetching Column Name

String colName = "col name";

ele.setAttribute("package","pkgName");

Element class_ele = new Element("class");

class_ele.setAttribute("name", className);

class_ele.setAttribute("table", tableName);

/*<id name="id" column="id" type="long">

<generator class="native" />

</id>*/

Element id_ele = null;

if(idList.size() == 1) {

id_ele = new Element("id");

id_ele.setAttribute("name", convertToValName(idList.get(0).toString()));

id_ele.setAttribute("column", idList.get(0).toString());

id_ele.setAttribute("type", "String");

} else {

id_ele = new Element("composite-id");

id_ele.setAttribute("name", "compositeID");

id_ele.setAttribute("class", "compositeClass");

for(int i=0;i<idList.size();i++) {

id_ele.addContent(new Element("key-property")

.setAttribute("name",convertToValName(idList.get(i).toString()))

.setAttribute("column",idList.get(i).toString())

.setAttribute("type","string")

);

}

}

ele.addContent(class_ele);

doc_crea.addContent(ele);

File file = new File(fpath+"\\"+className+".hbm.xml");

FileOutputStream out = new FileOutputStream(file);

XMLOutputter outp = new XMLOutputter();

outp.output(doc_crea, out);

>

shinde_yogesha at 2007-7-12 10:32:13 > top of Java-index,Desktop,Core GUI APIs...