Im trying to select nodes that contain a given string in one of its attributes, but it seems that I can only do it on a certain attribute.
var tempUsers = xmlDocument.selectNodes("//Users/*[contains(@Id,'TEXT')]");
I guess that instead of @Id I can write something else to check all the attributes of a node and not only the Id.
thanks.
You can use
@*in xpath to select all attributes, but the naivewill not do what you expect. The
containsfunction expects its arguments to be strings, so if you give it a node set instead it will first convert the node set to a string (by taking the string value of the first node in the set) and then use that value in the function. Instead you need to saywhich will find all
Userselements in the document and then select all their child elements that have any attribute whose value contains the substringTEXT.