[DomCrawler] Improve namespace discovery performance
Up until now xpath axes (child::*, descendant-or-self::** etc) were considered namespaces. As a result, far too many xpath queries were being executed while namespace discovery.
This commit is contained in:
parent
49c60d7383
commit
b6af00292d
@ -1027,7 +1027,7 @@ class Crawler extends \SplObjectStorage
|
||||
*/
|
||||
private function findNamespacePrefixes($xpath)
|
||||
{
|
||||
if (preg_match_all('/(?P<prefix>[a-z_][a-z_0-9\-\.]*):[^"\/]/i', $xpath, $matches)) {
|
||||
if (preg_match_all('/(?P<prefix>[a-z_][a-z_0-9\-\.]*):[^"\/:]/i', $xpath, $matches)) {
|
||||
return array_unique($matches['prefix']);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user