posted 11 years ago
Hi,
Below is code works for getting the tag value of same name for eg here it is
<PAN>
<PANNO></PANNO>
<PANNO></PANNO>
<PANNO></PANNO>
<PANNO></PANNO>
</PAN>
NodeList nPanList = doc.getElementsByTagName("PAN");
for(int temp = 0 ; temp <nPanList.getLength(); temp++){
Node nNode = nPanList.item(temp);
Element eElement = (Element) nNode;
NodeList childList = eElement.getChildNodes();
String [] sPANNO = new String[childList.getLength()] ;
for(int i = 0; i < childList.getLength(); i++){
Node childNode = childList.item(i);
sPANNO[i] = childNode.getNodeName() + "\t" + childNode.getTextContent();
System.out.println(sPANNO[i]);
}
}
Thanks!