xquery4 2.2.0
See the version list below for details.
dotnet tool install --global xquery4 --version 2.2.0
dotnet new tool-manifest
dotnet tool install --local xquery4 --version 2.2.0
#tool dotnet:?package=xquery4&version=2.2.0
nuke :add-package xquery4 --version 2.2.0
xquery
Command-line XQuery 3.1/4.0 processor for .NET. Query XML documents from the terminal using the PhoenixmlDb XQuery engine.
Installation
dotnet tool install -g xquery4
Usage
# Query an XML file
xquery '//book/title' library.xml
# Count elements
xquery 'count(//item)' catalog.xml
# Read from a query file
xquery -f transform.xq input.xml
# Query a directory of XML files
xquery 'collection()//product[price > 50]' ./data/
# JSON output
xquery -o json 'map { "count": count(//item) }' data.xml
# Read from stdin
cat data.xml | xquery '//item/@name'
# Show execution plan
xquery --plan 'for $x in 1 to 10 return $x * $x'
# Show timing breakdown
xquery --timing '//item' large-catalog.xml
Features
- XQuery 3.1/4.0 — FLWOR, maps/arrays, higher-order functions, string constructors
- Multiple output methods — adaptive, XML, text, JSON
- Context item — input XML is available as
.(standard XQuery) - Multiple sources — files, directories, URLs, stdin
- Full prolog support — namespaces, variable/function declarations, serialization options
- Execution plans — inspect how queries are compiled and optimized
- Timing — built-in performance profiling
Documentation
Full documentation at phoenixml.dev
License
Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.6.0 | 42 | 10/6/2026 |
| 2.5.1 | 81 | 10/1/2026 |
| 2.4.1 | 82 | 9/28/2026 |
| 2.4.0 | 63 | 9/28/2026 |
| 2.2.0 | 284 | 9/25/2026 |
| 2.1.0 | 74 | 9/17/2026 |
| 2.0.0 | 75 | 9/15/2026 |
| 1.8.0 | 85 | 9/14/2026 |
| 1.7.0 | 79 | 9/11/2026 |
| 1.6.15 | 78 | 9/9/2026 |
| 1.6.14 | 95 | 9/7/2026 |
| 1.6.13 | 82 | 9/4/2026 |
| 1.6.12 | 81 | 9/1/2026 |
| 1.6.11 | 87 | 8/29/2026 |
| 1.6.10 | 87 | 8/29/2026 |
| 1.6.9 | 81 | 8/27/2026 |
| 1.6.8 | 79 | 8/26/2026 |
| 1.6.7 | 89 | 8/24/2026 |
| 1.6.6 | 85 | 8/23/2026 |
| 1.6.5 | 90 | 8/21/2026 |
Takes **PhoenixmlDb.Core 2.0.0** (unchanged — Core runs its own cadence).
### Added
**The built-in list types are now cast and castable targets** (#74). XQuery 3.0 permits
`xs:IDREFS`, `xs:NMTOKENS` and `xs:ENTITIES` in this position even though a list type is not an
item type: the lexical form is split on whitespace and each token cast to the member type, so the
result is a **sequence**.
```xquery
"a b c" cast as xs:IDREFS (: ('a','b','c'), of type xs:IDREF* :)
"a b c" castable as xs:IDREFS (: true :)
"1 2 3" castable as xs:IDREFS (: false :)
```
These previously reported `XPST0051: 'xs:IDREFS' is not a recognized atomic type` — a true
statement about a list type and the wrong answer in this position.
### Fixed
**The `xquery` CLI printed a .NET type name for a function item** (#76, closes #75).
```
$ echo 'function($x){$x}' > q.xq && xquery -f q.xq
PhoenixmlDb.XQuery.Execution.InlineFunctionItem
```
`PhoenixmlDb.XQuery.Cli` carries its own `ResultSerializer` alongside the engine's
`XQueryResultSerializer`, and it had no case for a function item at all, so one fell through to
`item.ToString()`.
### Conformance
**W3C QT3 29,803 / 31,379 (94.98%)**, up 63 from 2.1.0's 29,740.
Worth stating how those 63 were earned, because not every conformance movement is the same kind:
**#74 implements the feature**, so the denominator stays 31,379 and the passes rise. That is
different from a harness-honesty fix, which raises the percentage by removing cases from the
count. Both are legitimate; only one of them means the engine does more than it did.