While using getNodeName, it will return actual value with "#text" as prefix. I do not want that prefix.
If I remove space and newlines, getNodeName is working fine. I am using DocumentBuilderFactory,DocumentBuilder and Document for parse xml.
My XML file
<test>
<a>
file1
</a>
<b>
file2
</b>
<c>
<files>
<file>
myfile1
</file>
</files>
</c>
</test>
My java Method
NodeList childNodes = null;
NodeList parentNodes = xml.getNodeList("test");
int node_len = parentNodes.getLength();
for (int i = 0; i < node_len; i++)
{
childNodes = parentNodes.item(i).getChildNodes();
int child_len = childNodes.getLength();
for (int j = 0; j < child_len; j++)
{
Node dataNode = childNodes.item(j);
System.out.println(dataNode.getNodeName());
}
}
Please help me to clear this issue. Thanks is advance.