Check if element in XML exists that ends with matching string



I can see a way of searching for an element within XML by just going:



if(doc.SelectSingleNode("//mynode")==null)


But what I'm more interested in, is finding an element that matches the part of the name. Something like:


doc.SelectSingleNode ...that contains "table" in it. So if I had a node called "AlinasTable", I want it to find that. Why it matters is because my node can inconsistently contain anything that comes before "table", like "JohnsTable" - in which case I'd want that to be returned. So something more generic.


Cheers.


No comments:

Post a Comment