public static void printNode(NodeList nodeList, Document d)
{
for (int count = 0; count < nodeList.getLength(); count++)
{
Node tempNode = nodeList.item(count);
if (tempNode.getNodeType() == Node.ELEMENT_NODE)
{
if(tempNode.getChildNodes().getLength()==1)
{
if(tempNode.getNodeName()=="param-name")
{
tempNode = tempNode.getNextSibling();
System.out.println(tempNode.getTextContent());
}
}
else if (tempNode.getChildNodes().getLength() > 1)
{
printNode(tempNode.getChildNodes(),d);
}
else
{
print("ELSE")
}
}
}
}
I just want to access and get text value from tag from this xml.file
<context-param>
<param-name>A</param-name>
<param-value>604800000</param-value>
</context-param>
<context-param>
<param-name>B</param-name>
<param-value>50</param-value>
</context-param>
<context-param>
<param-name>C</param-name>
<param-value>1</param-value>
</context-param>
but it's not work, the output is BLANKLINE _BLANKLINE_ BLANKLINE . . . .
So, anyone have an ideas ?
thank you very much .