Hurrey
, I have done it.
What I did, I modified the Document(ie JDOM Tree) and then transfer the changes to actual xml document.
The code is:
try
{
SAXBuilder sb = new SAXBuilder();
Document db = sb.build(new File("D:/weblogic/wlserver6.0/config/mydomain/applications/DefaultWebApp_myserver/jsp/hotel/myHotel.xml"));
Element rtel = db.getRootElement();
Element hotel = rtel.getChild("hotel");
Element general = hotel.getChild("general");
Element name = general.getChild("name");
name.setText(hotelname);
XMLOutputter xout = new XMLOutputter();
xout.output(db,(Writer)(new FileWriter(new File("D:/weblogic/wlserver6.0/config/mydomain/applications/DefaultWebApp_myserver/jsp/hotel/myHotel.xml"))));
}
Anybody, who is interested in JDOM, can use JDOM very easily, it is very easy as compared to XML4J.
Cheers