Kiril
Kiril

Reputation: 40345

Convert CSS Selector to XPATH

I saw an article online on how to map CSS selectors to XPATH queries, so I'm trying to figure out if there are any .NET libraries out there that can do the mapping/conversion. Please let me know if you have any references or any ideas on how to perform the mapping (if a library is not available).

Upvotes: 5

Views: 3326

Answers (1)

MUG4N
MUG4N

Reputation: 19717

You could try the Css2Xpath library found here: https://bitbucket.org/MostThingsWeb/css2xpath/wiki/Home

I have never used it but maybe you can share your experience with us.

Here is a small sample of usage:

String css = "div#test .note span:first-child";
String xpath = css2xpath.Transform(css);

Upvotes: 7

Related Questions