This Example describes a method to create a new DOM tree .Methods which are used for making a new DOM parse tree are described below :-
Element root = doc.createElement("places"):-it is a method to Create an Element node.
doc.appendChild(root):-This method adds a node after the last child node of the specified element root.
Element root = doc.getDocumentElement():-allows direct access to the root of the DOM document.
Xml code for the program generated is:-
<?xml version="1.0" encoding="UTF-8"?> <!-- Document : Document6.xml Created on : 10 July, 2008, 5:20 PM Author : girish Description: Purpose of the document follows. --> <root>
Output of the program:-
Name of the root created is:- Company
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.