I have a XML object and I am wanting to return the text value on the node which may have a number of child nodes.
<binding name="s"><bnode>b1fff4d00000000fe</bnode></binding>
<binding name="p"><uri>http://cidoc-crm.org/P1F.is_identified_by</uri></binding>
<binding name="zebra"><literal>copper</literal></binding>
In the above case i am wanting to return the text in each node were I can specify the name value of the binding.
pseudo code:
get text where binding name value == “s” ;
I have tried this
x[i].getElementsByTagName("binding")[0].childNodes[0].nodeValue
so it shouldn’t matter what the child node name is in this case bnode.
I hope thats clear
Thanks.
Easiest way to get the text content would be
However,
textContentis unsupported in IE < 9, so you will need to navigate through to the text node in those browsers:Demo: http://jsfiddle.net/p2SrZ/