I used the factory to create the parser. Before creating the parser, I first turn validation on using the setValidating(true) method. Then I create the parser.

Pramod Hirole

You must be having white space in an element name. eg.

 Element elm = document.createElement("A B");
which will appear as follows:
<A B>
in your XML file or document. XML does not allow white space in an element name. If you want white space to occure in an element name you should replace it by an appropriate entity to replace white space character.