Hi I have one XML file which contains following form of tags
<values>
<value>Yes</value>
<value>No</value>
<value>other</value>
</values>
what I need to do with is, I need iterate over these tags and get the values. I am using DOM parser technique to parse the XML file. How do I do this.
Note : <value>
tag can increase in number. According to that, with the help of Java code I would be able to get all values from <value>
tag .
This is what I did.
NodeList nodeList = doc.getElementsByTagName("values");
for (int temp1 = 0; temp1 < nodeList.getLength(); temp1++)
{
Node node = nodeList.item(temp1);
if(node.getNodeType() == Node.ELEMENT_NODE)
{
Element element = (Element)node;
String value = element.getElementsByTagName("value").item(0).getTextContent();
System.out.println("Values are:::" + value);
}
}