simonkimi / xpath_selector

An XPath selector for locating Html and Xml elements
BSD 3-Clause "New" or "Revised" License
20 stars 4 forks source link

Attribute selector not working #9

Closed Z6P0 closed 2 years ago

Z6P0 commented 2 years ago

XPath "//element/@attribute" does not select the attribute but the element node.

simonkimi commented 2 years ago

For attributes, use their .attrs method. Example

Z6P0 commented 2 years ago

Yes but I expected the library to return the proper node. I'm not supposed to parse the query myself to test if it's an attribute or not.

simonkimi commented 2 years ago

In this package, attribute is not treated as an node, but string. This feature may be added in the future.