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

xpath: Cannot select attribute? #15

Closed
SuperKenVery opened this issue Jul 19, 2023 · 1 comment · Fixed by #24
Closed

xpath: Cannot select attribute? #15

SuperKenVery opened this issue Jul 19, 2023 · 1 comment · Fixed by #24

Comments

@SuperKenVery
Copy link

For example,

document:

<input name="hi" id="in"></input>

I hope

//*[@id="in"]//@name

to return a Vec containing hi, but in fact it returns an empty Vec.

This syntax works in python lxml, so I guess it's a problem with this library?

@James-LG
Copy link
Owner

Yes, attribute selection with XPath has not yet been implemented, but it is on my todo list.

In the meantime you can just get the node with XPath and use the library to retrieve the attributes. See the docs here.

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 a pull request may close this issue.

2 participants