-3

Possible Duplicate:
How to read an XML file with Java?

CLOSED

Community
  • 1
  • 1
WelcomeTo
  • 19,843
  • 53
  • 170
  • 286
  • [Here](http://stackoverflow.com/questions/7373567/java-how-to-read-and-write-xml-files/7373596#7373596) you can find a complete SAX example. Ignore the DTD if you do not want to use it. – Costis Aivalis Jan 27 '12 at 10:53

2 Answers2

0

There's only one element with grantee-template tag name. You seem to expect two. What you are really look for is its two children.

Michael Krelin - hacker
  • 138,757
  • 24
  • 193
  • 173
0

Replace your first statement

NodeList granteeTemplate = doc.getElementsByTagName("grantee-template")

with

NodeList granteeTemplate=doc.getDocumentElement().getChildNodes();
pavan
  • 3,225
  • 3
  • 25
  • 29