In PHP, i want to get all DOMElement containing a given text.
I get DOMText when $xpath->query("//text()[contains(., 'My String')]"), but which query must i perform for getting DOMElement instead?
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.
Use:
This selects the first element in the XML document that has a text node child that contains the string
"My String".If it is guaranteed that only one such element exist, the above expression can be simplified to:
If the elements you are looking for are guaranteed to have just a single text-node child, this expression can be simplified to:
respectively: