I am parsing the below XML using the Dom Parser.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<company>
<Staff id="1">
<firstname>Achyut</firstname>
<lastname>khanna</lastname>
<nickname>Achyut</nickname>
<salary>900000</salary>
</Staff>
</company>
If I only need firstName from the XML why is returning null ?
private String getNodeValue(Node node) {
Node nd = node.getFirstChild();
try {
if (nd == null) {
return node.getNodeValue();
}
else {
getNodeValue(nd);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Nodeargument?