benibela / xidel

Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
http://www.videlibri.de/xidel.html
GNU General Public License v3.0
674 stars 42 forks source link

XPath and XQuery 3.1? #37

Closed joewiz closed 3 years ago

joewiz commented 4 years ago

Hi Benito,

A stack overflow question led me to install xidel (via homebrew) and take it for a spin. It's really nice work - I'm enjoying running XQuery very rapidly on remote URLs via the command line.

I'm wondering if you have any plans to support XPath and XQuery 3.1 functions? I found myself reaching for fn:sort, for example. If there's already partial support, do you have a list of implemented/unimplemented functions? Are there any other caveats about the language level supported in xidel? Have you have run xqts on the XQuery engine?

Thanks! Joe

Reino17 commented 4 years ago

The latest development snapshots already contain some XQuery 3.1 functions. If I'm correct then the next stable release will have full XQuery 3.1 support.

Xidel / Internet Tools function list

benibela commented 4 years ago

The 3.1 functions are almost all there, but the data structures are not. Biggest issue is that my maps have strings as keys, but 3.1 maps can have keys of any type. I need to completely rewrite the maps

Here are the old xqts 3.0 results of the last release: http://benibela.de/documentation/internettools/xqts.html

Here is the current state for 3.1: xquery31.html.gz

benibela commented 3 years ago

Now I have implemented all functions

Although there are still failing tests xqts.zip

I used your xml-to-json/json-to-xml functions, you know how they are. Some places still have jsoniq/string maps. libicu does not support alternate=blanked for UCA collations. The regex library only matches assigned codepoints. The JSON parser does not do fallback escapes