Re:Crystal in Production: Diploid
by nurettin on Saturday October 28, 2017 @01:50PM
(#15575990)
Would love to have a nokogiri-level xpath or css3 selector capabilities. I'm up to my neck with projects, but this looks like a good start: https://github.com/jgehring/hcxselect/tree/83d3edaa8a6944d20...
[ Parent
| on HN ]
We have libxml2 bound in the stdlib with xpath support, do you need more?
Yes! it would take a lot of hard work to convert all my css3 selectors to xpath.
I think having css3 to xpath selector conversion in the stdlib (or perhaps a shard based on how complex it is)would be possible. It would be great if you could open an issue in crystal's repo.
Re:Crystal in Production: Diploid
by ricardobeat on Saturday October 28, 2017 @03:41PM
(#15576468)
This shard implements a CSS selector API on top of an html parser: https://github.com/kostya/modest
If only it was compatible with the existing XML interface...
Re:Crystal in Production: Diploid
by ricardobeat on Sunday October 29, 2017 @08:31AM
(#15579061)
XML has way more surface area than HTML, you could only query a small subset of valid XML documents with CSS. Plus, these days nobody uses XML parsers for HTML anymore, their behavior has diverged; things like behaviour of unclosed elements, valid children tags, are defined in the HTML spec and not possible in XML.