← Prev in month
← Prev in thread
Next in thread →
Next in month →
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
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
Stay connected with your friends even when away from PC. Link: http://in.mobile.yahoo.com/new/messenger/
← Prev in month
← Prev in thread
Next in thread →
Next in month →