I have managed to drill down to the element that I want. Here is an example of the html markup
<p> <strong> Title foo </strong> foo bar foo bar </p>
Is there a way to check if the string of a node contains <strong> or <b> etc? Is there a way to do this with DOMDocument or would I have to implement an xpath solution??
Thanks.
Try looking at the
textContentproperty of the node. Watch out,textContentsearches both the node and all descendants. If you need a precise match and don’t want to crawl the tree yourself, then a xpath solution would probably be faster.