-3

I have:

<div class="posts">
    <p class="post">info: abcd</p>
    ....
</div>

I am trying to use xpath to select the

containing "info: abcd"

I have:

$DNlist = $xpath->query("//div[@class='posts']/p[contains(., 'info:')]]");

This gives:

Severity: Warning
Message: DOMXPath::query(): Invalid expression

How can I fix this?

hakre
  • 193,403
  • 52
  • 435
  • 836
user1592380
  • 34,265
  • 92
  • 284
  • 515

1 Answers1

1

There seems to be on square bracket (]) to much. Try:

"//div[@class='posts']/p[contains(., 'info:')]"
hr_117
  • 9,589
  • 1
  • 18
  • 23