简体   繁体   English

将CSS Selector转换为XPATH

[英]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. 我在网上看到了一篇关于如何将CSS选择器映射到XPATH查询的文章 ,所以我试图弄清楚是否有任何.NET库可以进行映射/转换。 Please let me know if you have any references or any ideas on how to perform the mapping (if a library is not available). 如果您对如何执行映射有任何参考或任何想法(如果库不可用),请告诉我。

You could try the Css2Xpath library found here: https://bitbucket.org/MostThingsWeb/css2xpath/wiki/Home 您可以尝试在此处找到的Css2Xpath库: 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM