Live data from Hacker News

Show HN: Xq – command-line XML and HTML beautifier and content extractor

github.com

1–10 of 36 posts

Re: Show HN: Xq – command-line XML and HTML beautifier and content extractor

#2
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.

Re: Show HN: Xq – command-line XML and HTML beautifier and content extractor

#3

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.

Thank 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 :)

Re: Show HN: Xq – command-line XML and HTML beautifier and content extractor

#6

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.

htmlq does that.

Re: Show HN: Xq – command-line XML and HTML beautifier and content extractor

#7

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.

Thank 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 :)

The 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

Re: Show HN: Xq – command-line XML and HTML beautifier and content extractor

#8
There's an ancient formatter I've been using for years (gasp, probably well over a decade) https://xml-coreutils.sourceforge.net/ ... xml-fmt (https://xml-coreutils.sourceforge.net/xml-fmt_man.html)

It'll be nice to try something new. swiss army style command line XML tools has been pretty neglected.

Post reply on HN