How do I select child elements of any depth using XPath?
//form/descendant::input[@type='submit']
You're almost there. Simply use:
//form[@id='myform']//input[@type='submit']
The //
shortcut can also be used inside an expression.
If you are using the XmlDocument and XmlNode.
Say:
XmlNode f = root.SelectSingleNode("//form[@id='myform']");
Use:
XmlNode s = f.SelectSingleNode(".//input[@type='submit']");
It depends on the tool that you use. But .// will select any child, any depth from a reference node.