Home » Category » Java Essentials

Java Essentials: xml file: searching for text value

300| Sat, 22 Sep 2007 15:26:00 GMT| kstrooba| Comments (1)

Hi,

I want to search in my xml file for a value of text element(= the value). And then processing the node value.

//Traversalling recursively in the tree

private static void processNodeRecursively (Node node, String rule)

{

if((node.getNodeValue()).equals(rule))

{

//some code for processing the node

}

for(Node child = node.getFirstChild(); child != null;

child = child.getNextSibling())

{

processNodeRecursively(child, rule);

}

}

But with this method, the program doesnt travel in the xml file. If i change node.getNodeValue in node.getNodeName then it travels nicely but i dont need the name of an element but the value of a text element. So any one some advice for searching a text value in an xml file.

Keywords & Tags: xml, file, searching, text, value, java, essentials

URL: http://java.itags.org/java-essentials/80752/
 
«« Prev - Next »» 1 helpful answers below.
Problem solved, using the method getNodValue looks to a child and gets stuck too soon using the methodprocessNodeRecursively Greetz,Koen

kstrooba | Thu, 05 Jul 2007 22:31:00 GMT |

Java Essentials Hot Answers

Java Essentials New questions

Java Essentials Related Categories