6 ms·
xpath is so fucking cool i can understand why it failed for general use, but shit like this revives my excitement q: i'm not an expert, this looks like it ext
by css_apologist 8mo ago
xpath is so fucking cool
i can understand why it failed for general use, but shit like this revives my excitement
q: i'm not an expert, this looks like it extends xpath syntax? haven't seen stuff like the /map is this referring to the html map element? or a fp-style map?
- rodricios 8mo agoI think xpath is cool too! If wxpath can help revive some of that excitement, then I consider my project a success. As for your question, while wxpath does extend the xpath syntax, `/map` is not one of its additions, nor is it a html map element. XPath 3.1 introduced first-class maps (and arrays) (https://www.w3.org/TR/xpath-31/#id-maps https://www.w3.org/TR/xpath-31/#id-maps), and `/map` is the syntax to create said structure. It's an awesome feature that's especially useful for quickly delivering JSON-like objects.
- css_apologist 8mo agosick, ty
- rhdunn 8mo agoMaps were added in XPath 3.1 -- https://www.w3.org/TR/xpath-31/#id-maps https://www.w3.org/TR/xpath-31/#id-maps. There's currently work on XPath 4.0 -- https://qt4cg.org/specifications/xquery-40/xpath-40.html https://qt4cg.org/specifications/xquery-40/xpath-40.html.
- jerf 8mo agoXPath may have "failed" for general use but it's generally well-enough supported that I can find a library in the common languages I've used when I went looking for it. In some ways the hard part is just knowing it exists so you can use it if you need it.
- rodricios 8mo agoCouldn't agree more. I should also add that most (Python-based) web crawling and scraping frameworks support XPath engines OOTB: Scrapy, Crawlee, etc. In that sense, XPath is very much alive.