Normalize All of the Text in a Document
This Example describes a method to Normalize all of the Text in a DOM document. Methods which are used for Normalizing the text node in the DOM Document are described below :-
Element root = doc.getDocumentElement():-allows direct access to the root of the DOM document.
root.getNodeName():-gives the node name of the root.
root.normalize():-it normalize All of the Text in a Document
Xml code for the program generated is:-
<?xml version="1.0"
encoding="UTF-8"?> <Company> <Location> <Companyname>Roseindia .Net</Companyname> <Employee>Girish Tewari</Employee> </Location> </Company> |
NormaliseText.java:
/* |
Output of the program:-
Normalize root is: Company |