I have the XML as follows.
<issn>0040-6031</issn>
<volume-issue-number>
<vol-first>630</vol-first>
<suppl>C</suppl>
</volume-issue-number>
<collection-title>Thermochimica Acta Ila Modified on 7</collection-title>
**
- Elements issn and collection-title is repeating several times in my xml file.
- I have to find the collection-title value for the given issn input
- Exactly need to get the second sibling element collection-title value to the given element issn.
- But now I can only able to reach the element.
- below i have provided my code .can any one please help me achieve this?
- Thanks in advance.
Code Snippet
doc.getDocumentElement().normalize();
NodeList nList2=doc.getElementsByTagName("issn");
if(nList2.getLength()>=1)
{
for (int temp2 = 0; temp2 < nList2.getLength(); temp2++) {
Node nNode4 = nList2.item(temp2);
if (nNode4.getNodeType() == Node.ELEMENT_NODE)
{
Element eElement1 = (Element) nNode4;
issn_value[temp2]=eElement1.getTextContent();
if(issn_value[temp2].equalsIgnoreCase(issn_value_DB))
{
System.out.println("Inside issn value comparision:XXXXX");
System.out.println("equal issn found..");
System.out.println("value : "+issn_value[temp2]);
System.out.println("issn value from DB :"+issn_value_DB);
Node sibling = eElement1.getNextSibling();
while (!(sibling instanceof Element) && sibling !=null) {
sibling = sibling.getNextSibling();
System.out.println(" Get the Name of the Next Sibling "+ sibling.getNodeName());
System.out.println(" Get the Value of the Next Sibling "+ sibling.getTextContent());
}
}
}
}
}