4 ms·
Neat! Like Jq but for XML and HTML. Have you considered adding css sectors as an alternative to xpath? For many simple things a css selector is easer to write
by samwillis 4y ago
Neat! Like Jq but for XML and HTML.
Have you considered adding css sectors as an alternative to xpath? For many simple things a css selector is easer to write and more people already know them.
I believe it's possible to translate css selectors to xpath so it wouldn't need another selection engine.
- sibprogrammer 4y agoThank you for your support! I didn't consider CSS selectors as an alternative to Xpath, but really like the idea. Absolutely agree CSS selectors will be more convenient :)
- esprehn 4y agoThe issue with CSS selectors is they can only express element selection. There's no concept of picking the text of the element or the value of an attribute. There's been proposals over the years to support pseudo elements for that, so you could make something up like ::attr(name) and ::text, but nothing in the standards. htmlq does this by having various command line options like --attribute and --text. https://github.com/mgdm/htmlq#examples https://github.com/mgdm/htmlq#examples
- samwillis 4y agoQuite a few scraping (such as Scrapy) or browser automated testing frameworks (like Playwright) have standardised on ::text. I would take a look around and if other tools are using the same none standard selectors for these features, it would be perfect for Xq. It's not like you are complying with standards for browser compatibility.
- mk12 4y agohtmlq does that.
- deleted 4y ago[deleted]