F
FX
I've a scenario where i need to parse all children with a name
"interestingNodes" under a "Tree".
<Tree>
<fruits>
<interestingNotes>....</interestingNotes>
<fruit>
<type>apple</type>
<interestingNotes>....</interestingNotes>
<vitamins>
....
<interestingNotes>....</interestingNotes>
<vitamins>
<fruit>
</fruits>
<interestingNotes>
<roots>.....</roots>
</Tree>
So here I want to extract all <interestingNotes> whether it's at
<tree>, <fruits> or <fruit> level.
I was trying this
NodeList fruits =
treeNode.getChildNodes();
Node n;
int j=0;
String nam;
for(; j<fruits.getLength();j++){
n = fr.item(j);
nam= n.getNodeName();
if (nam.startsWith("interestingNotes"))
break;
}
But this doesnt get all <interestingNotes> Is there a method of
getting all children?
"interestingNodes" under a "Tree".
<Tree>
<fruits>
<interestingNotes>....</interestingNotes>
<fruit>
<type>apple</type>
<interestingNotes>....</interestingNotes>
<vitamins>
....
<interestingNotes>....</interestingNotes>
<vitamins>
<fruit>
</fruits>
<interestingNotes>
<roots>.....</roots>
</Tree>
So here I want to extract all <interestingNotes> whether it's at
<tree>, <fruits> or <fruit> level.
I was trying this
NodeList fruits =
treeNode.getChildNodes();
Node n;
int j=0;
String nam;
for(; j<fruits.getLength();j++){
n = fr.item(j);
nam= n.getNodeName();
if (nam.startsWith("interestingNotes"))
break;
}
But this doesnt get all <interestingNotes> Is there a method of
getting all children?