Example #1
0
 protected function getXPath($content)
 {
     $document = new DOMDocument();
     $document->strictErrorChecking = false;
     $document->loadXML($content, LIBXML_NOERROR | LIBXML_NONET | LIBXML_NOWARNING);
     $xpath = new DOMXPAth($document);
     $xpath->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml');
     return $xpath;
 }
Example #2
0
 protected function getXPath($content)
 {
     $document = new DOMDocument();
     $document->strictErrorChecking = false;
     if ($this->options['tidy'] && extension_loaded('tidy')) {
         //Convert and repair as xhtml
         $tidy = new tidy();
         $content = $tidy->repairString($content, $this->options['tidy_config']);
     }
     $document->loadXML($content, LIBXML_NOERROR | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOCDATA);
     $xpath = new DOMXPAth($document);
     $xpath->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml');
     return $xpath;
 }