Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Component][DomCrawler] fix axes handling in Crawler::filterXPath() #11548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2014

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Aug 2, 2014

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11503
License MIT
Doc PR

Due to some limitations in the relativize() method, it was not possible to use XPath axes other than descendant or descendant-or-self in the filterXPath() method of the Crawler class. This commit adds support for the ancestor, ancestor-or-self, attribute, child, following, following-sibling, parent, preceding, preceding-sibling and self axes.

The only axis missing after this is the namespace axis. Filtering for namespace nodes returns DOMNameSpaceNode instances which can't be passed to the add() method.

Due to some limitations in the relativize() method, it was not
possible to use XPath axes other than descendant or descendant-or-self
in the filterXPath() method of the Crawler class. This commit adds
support for the ancestor, ancestor-or-self, attribute, child,
following, following-sibling, parent, preceding, preceding-sibling and
self axes.
@fabpot
Copy link
Member

fabpot commented Aug 3, 2014

Thank you @xabbuh.

@fabpot fabpot merged commit 8dc322b into symfony:2.3 Aug 3, 2014
fabpot added a commit that referenced this pull request Aug 3, 2014
…erXPath() (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[Component][DomCrawler] fix axes handling in Crawler::filterXPath()

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11503
| License       | MIT
| Doc PR        |

Due to some limitations in the ``relativize()`` method, it was not possible to use XPath axes other than ``descendant`` or ``descendant-or-self`` in the ``filterXPath()`` method of the ``Crawler`` class. This commit adds support for the ``ancestor``, ``ancestor-or-self``, ``attribute``, ``child``, ``following``, ``following-sibling``, ``parent``, ``preceding``, ``preceding-sibling`` and ``self`` axes.

The only axis missing after this is the ``namespace`` axis. Filtering for namespace nodes returns ``DOMNameSpaceNode`` instances which can't be passed to the ``add()`` method.

Commits
-------

8dc322b fix axes handling in Crawler::filterXPath()
@xabbuh xabbuh deleted the issue-11503 branch August 3, 2014 06:59
xabbuh added a commit to xabbuh/symfony that referenced this pull request Aug 9, 2014
The previous fix in symfony#11548 for handling XPath axes was not backward
compatible. In previous Symfony versions the Crawler handled nodes
by holding a "fake root node". This must be taken into account when
evaluating (relativizing) XPath expressions.
xabbuh added a commit to xabbuh/symfony that referenced this pull request Aug 9, 2014
The previous fix in symfony#11548 for handling XPath axes was not backward
compatible. In previous Symfony versions the Crawler handled nodes
by holding a "fake root node". This must be taken into account when
evaluating (relativizing) XPath expressions.
stof added a commit that referenced this pull request Aug 19, 2014
This PR was merged into the 2.3 branch.

Discussion
----------

[DomCrawler] fix the axes handling in a bc way

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11503
| License       | MIT
| Doc PR        |

The previous fix in #11548 for handling XPath axes was not backward compatible. In previous Symfony versions the Crawler handled nodes by holding a "fake root node". This must be taken into account when evaluating (relativizing) XPath expressions.

Commits
-------

d26040f [DomCrawler] fix the axes handling in a bc way
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants