XPath: How to select elements based on their value?

I am new to using XPath and this may be a basic question. Kindly bear with me and help me in resolving the issue. I have an XML file like this: <RootNode> <FirstChild> <Element attribute1=”abc” attribute2=”xyz”>Data</Element> <FirstChild> </RootNode> I can validate the presence of an <Element> tag with: //Element[@attribute1=”abc” and @attribute2=”xyz”] Now I also want … Read more

How can I match on an attribute that contains a certain string?

I am having a problem selecting nodes by attribute when the attributes contains more than one word. For example: <div class=”atag btag” /> This is my xpath expression: //*[@class=”atag”] The expression works with <div class=”atag” /> but not for the previous example. How can I select the <div>? 10 Answers 10 Here’s an example that … Read more