Skip to content
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

Add support for tag="{*}name" in _Element.iter() and friends. #66

Merged
merged 2 commits into from
Aug 13, 2012

Conversation

SimonSapin
Copy link
Contributor

Such methods now have all combinations of wilcards to implement
CSS selectors NS|E, |E, *|E, NS|*, |*, and *|*

Internally the meaning of the qname.href struct field was changed:

  • The NULL pointer is a wildcard, matches any namespace
  • The empty Python byte-string matches elements without a namespace
  • Other Python byte-strings are namespace URIs, matching elements in
    the same namespace.

qname.c_name is uchanged (NULL for a wildcard, a C string for a
given local name.)

Such methods now have all combinations of wilcards to implement
CSS selectors NS|E, |E, *|E, NS|*, |*, and *|*

Internally the meaning of the qname.href struct field was changed:

* The NULL pointer is a wildcard, matches any namespace
* The empty Python byte-string matches elements without a namespace
* Other Python byte-strings are namespace URIs, matching elements in
  the same namespace.

qname.c_name is uchanged (NULL for a wildcard, a C string for a
given local name.)
The same change applies to the ``.getiterator()``, ``.itersiblings()``,
``.iterancestors()``, ``.iterdescendants()``, ``.iterchildren()``
and ``.itertext()`` methods as well as the ``strip_attributes()``,
``strip_elements()`` and ``strip_tags()`` functions.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently some stuff in iterpase.pxi also uses _MultiTagMatcher, but I’m not sure how that translates into the public API.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can pass a tag name into iterparse(), which then behaves essentially like .iter(tag), but during parsing. So it's affected as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted.

@scoder scoder merged commit 87d6821 into lxml:master Aug 13, 2012
@scoder
Copy link
Member

scoder commented Aug 13, 2012

Thanks!

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