phpphpquery

How use xpath queries in PHPQuery?


I'm looking for an example code how use xpath phpQuery. I read the wiki-pages but not found any thing. thanks in advance.


Solution

  • The project summary states

    phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library.

    As XPath is not part of CSS3 selectors and there are no references in the documentation, I'd say it hasn't been implemented.

    Update

    From digging through their source, it looks like it wraps DOMDocument and you can retrieve the documents from the phpQuery::$documents array. Once you have the DOMDocument instance, you can perform create a DOMXPath object and perform queries on it.