JavaScripter writing XQuery: Formatting XQuery code
My history lies with JavaScript with about 14 years of experience. I rolled into the XQuery world later on, building an Open Source XPath 3.1 / XQuery 3.1 processor in TypeScript before I wrote my first line of XQuery. Nowadays most of the code I’m writing in XPath or XQuery. A significant part of that is maintaining existing codebases.
I miss some of the ergonomy of developing in JavaScript. Any mature JS project includes prettier: an automatic code formatter. XQuery has no automatic formatter. XQdoc defines a styleguide, but manually applying codestyle makes no one apply it. XQLint comes with a formatter, but it does not format everything.
Introducing prettier-plugin-xquery: a plugin to Prettier that formats XQuery. Supporting XQuery 3.1 but extensible to format the other extensions and dialects, like the update node syntax in eXist-db,XQuery update facility, the Marklogic extensions and more.
The presentation will highlight the following subjects:
- Using the rex parser generator for parsing XQuery and its dialects,
- Merging multiple grammars to make a grammar for XQuery and all its dialects
- Using the plugin to format XPath in XSLT
- How to use this plugin in your daily development!
Martin Middel is a Dutch JavaScript dev rolled into XML technology. Het is one of the maintainers of the open source FontoXPath xpath engine. With a passion for bringing XML to the browser he is consulting for exist-solutions, jinntec and others. His favourite XML standard is BeerXML.