I have this XML file.I just parse this XML file.This example shows how to get the node by “name”, and display the value.How to show all records from database?
I don't think your XML is valid -- you're only allowed to have one root element in XML.
So when you do:
NodeList nList = doc.getElementsByTagName("record");
You're only going to get one element. which is that first
In order to fix this, you'll need to wrap all of your tags in some sort of a root element like this:
1
2
...
and you'll have to say:
NodeList nList = doc.getDocumentElement().getElementsByTagName("record");