advanced_html_dom
advanced_html_dom copied to clipboard
Selector valid in css/jquery but not in Advance Html Dom
address h2 :not(a)
This selector is valid but the script can't decode-it
ErrorException : DOMXPath::query(): Invalid expression
at /var/www/html/test/vendor/hrmatching/advanced_html_dom/advanced_html_dom.php:56
52| public function find($css, $index = null){
53| $xpath = CSS::xpath_for($css);
54| if(!isset($this->doc) || !isset($this->doc->xpath)) return null;
55| if(null === $index){
> 56| return new AHTMLNodeList($this->doc->xpath->query($xpath, $this->node), $this->doc);
57| } else {
58| $nl = $this->doc->xpath->query($xpath, $this->node);
59| if($index < 0) $index = $nl->length + $index;
60| $node = $nl->item($index);
Exception trace:
1 DOMXPath::query(".//address//h2//)[not(self::a)]")
/var/www/html/test/vendor/hrmatching/advanced_html_dom/advanced_html_dom.php:56
2 AdvancedHtmlBase::find("address h2 :not(a))")
/var/www/html/test/app/Console/Commands/FetchAgencyAddresses.php:66
Maybe try address h2 *:not(a)
On Thu, Nov 7, 2019 at 12:28 PM Gilbert Paquin [email protected] wrote:
address h2 :not(a) This selector is valid but the script can't decode-it
ErrorException : DOMXPath::query(): Invalid expression
at /var/www/html/test/vendor/hrmatching/advanced_html_dom/advanced_html_dom.php:56 52| public function find($css, $index = null){ 53| $xpath = CSS::xpath_for($css); 54| if(!isset($this->doc) || !isset($this->doc->xpath)) return null; 55| if(null === $index){
56| return new AHTMLNodeList($this->doc->xpath->query($xpath, $this->node), $this->doc); 57| } else { 58| $nl = $this->doc->xpath->query($xpath, $this->node); 59| if($index < 0) $index = $nl->length + $index; 60| $node = $nl->item($index);
Exception trace:
1 DOMXPath::query(".//address//h2//)[not(self::a)]") /var/www/html/test/vendor/hrmatching/advanced_html_dom/advanced_html_dom.php:56
2 AdvancedHtmlBase::find("address h2 :not(a))") /var/www/html/test/app/Console/Commands/FetchAgencyAddresses.php:66
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/monkeysuffrage/advanced_html_dom/issues/27?email_source=notifications&email_token=AAGVU7CUDD5JPQEYNFEKP6TQSOKP7A5CNFSM4JKBIJCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HXP2DZQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGVU7GQGHI3CJ3TP6LL6ZDQSOKP7ANCNFSM4JKBIJCA .
Same this was my first try