Im new to java. This is my first java code using parser, i was able to check the node value of particular tag by
if(name != null && name.equals("Length"))
how to pass multiple values in name value like name.equals("Length","Length1","Length3")), i have to check around 2000 values
below is partial code
if (file.exists()) {
Document doc = db.parse(file);
Element docEle = doc.getDocumentElement();
NodeList Line = docEle.getElementsByTagName("Lineno");
System.out.println("size " + Line.getLength());
if(Line != null && Line.getLength() > 0)
{
if(doc1.getDocumentElement() == null)
{
Element root1 = doc1.createElement("Line");
doc1.appendChild(root1);
}
for(int j = 0 ;j < nodeValue.getLength();j++)
{
Element el = (org.w3c.dom.Element) nodeValue.item(j);
String name = el.getAttribute("name");
String value = el.getAttribute("void");
String valueFromNode = el.getTextContent();
if(name != null && name.equals("id"))
{
ITEMID =valueFromNode;
}
if(name != null && name.equals("Length"))
{
// System.out.println("This has datcode " + ele);
datecode = "Yes";
cwi = valueFromNode;
// doc1.getDocumentElement().appendChild(doc1.importNode(imported, true));
}
}
}
}