[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] creating xml file
Hello Techies, I am trying to create xml file using DOM. Here is my code. public static void main(String[] args) { // TODO Auto-generated method stub try { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); DocumentBuilder db = fact.newDocumentBuilder(); Document doc = db.newDocument(); Element root = null; root = doc.createElement(application); doc.appendChild(root); Element aid = doc.createElement(application_Id); root.appendChild(aid); System.out.println("applicationId is added"); Text t = doc.createTextNode("application"); t.setNodeValue("test"); aid.appendChild(t); Text t1 = doc.createTextNode("ruleSet_Name"); t1.setNodeValue("1"); aid.appendChild(t1); } catch (ParserConfigurationException pce) { // TODO: handle exception System.out.println("ParserException" + pce.getMessage()); } } I want to store it with name application.xml . How can I do this one. Can u guys help me out regards,
ramu Send instant messages to your online friends http://in.messenger.yahoo.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|