symfony/symfony — pull request #6650 by jakzal (2013-01-10 10:00:13+00:00)
Title: [WIP][DomCrawler] Added auto-discovery of namespaces in filter() and filterByXPath()

I mentioned in #4845 it would probably be possible to use [DOMNode::lookupNamespaceURI()](http://www.php.net/manual/en/domnode.lookupnamespaceuri.php) to find a namespace URI by given prefix. Unfortunately we cannot use it here since we'd have to call it on a node in the namespace we're looking for.

Current implementation makes the following query to find a namespace:
```php
$domxpath->query('(//namespace::*[name()="media"])[last()]')
```

We could also allow specifying namespaces manually via a parameter (see #5886).

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #4845
Todo: it's a WIP: check if there's a nicer way
License of the code: MIT
Documentation PR: -