Originally posted by Paul Clapham:
In your case, after this line of code Element element = doc.getElementById("studid"); is executed, the "element" variable is null. That's because you made the common mistake of assuming that the getElementById() method looks for elements that have an attribute whose name is "id". It doesn't. It looks for elements that have an attribute that is defined, by a DTD or a schema, to be an "ID" attribute.
Thanx Paul, I learnt something new. I added the attribute "id" to the DTD, and then used the code. And it works fine.
-M