[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:
Jakub Zalas 2015-03-21 22:51:32 +00:00
parent 49c60d7383
commit b6af00292d

View File

@ -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']);
}