Given this XML, what XPath returns all elements whose prop attribute contains Foo (the first three nodes):
<bla> <a prop='Foo1'/> <a prop='Foo2'/> <a prop='3Foo'/> <a prop='Bar'/> </bla>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Works if I use this XML to get results back.
Edit: Another thing to note is that while the XPath above will return the correct answer for that particular xml, if you want to guarantee you only get the ‘a’ elements in element ‘bla’, you should as others have mentioned also use
This will search you all ‘a’ elements in your entire xml document, regardless of being nested in a ‘blah’ element
I added this for the sake of thoroughness and in the spirit of stackoverflow. 🙂