jact 19 hours ago

Xquery is what I would call a “weirdly good” language. It’s weird how good it is and how well designed it is relative to how little adoption it has.

The key thing is that since XML is a first-class datatype in XPath, trees are therefore a first class datatype. Since XPath is built into the language, you don’t need lenses or anything like that to do operations on deep tree structures. It just works. I am tempted sometimes to use it for more general projects than processing XML.

  • oever 8 hours ago

    At work, our entire website is generated with XQuery.

cyberpunk a day ago

This looks cool, Im quite uninformed about xml databases and xquery though, and I had foolishly assumed I had quite a broad exposure to tech stacks.

Whats this stuff used for?

  • smartmic a day ago

    I use XQuery to transform XML data. Whatever can be done with XSLT can also be done in XQuery. It is a functional language and, unlike XSLT, it is supported by more tools for newer versions (XSLT > 1.0 is only supported by Saxon, as far as I know). Overall, it feels much more modern and ergonomic for querying and transforming XML. Best of all: XQuery 3.1 supports JSON natively — I have also adopted it for JSON in some ETL pipelines.

    Check Wikipedia for more information: https://en.wikipedia.org/wiki/XQuery

victorbjorklund 21 hours ago

Cool. Elixir dev here but less familiar with XML (other than html). When would this be useful? Like any common usecases?

  • dledesma 17 hours ago

    I used XQuery at an old job where we received XML payloads from a third-party service and would use it to massage payloads that were malformed or that our system had a bug when processing them so that we could store the XQuery transformation in the database for auditing and reproducibility. It was a pretty unenjoyable experience and I would've preferred to manually edit the payloads directly but that's legacy systems for you.

    Hopefully someone else can chime in and sell it better than me. 8^)

    • victorbjorklund 8 hours ago

      make sense! I might have similar thing on a pending project.