PhoenixmlDb.XQuery 1.6.14

There is a newer version of this package available.
See the version list below for details.
dotnet add package PhoenixmlDb.XQuery --version 1.6.14
                    
NuGet\Install-Package PhoenixmlDb.XQuery -Version 1.6.14
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PhoenixmlDb.XQuery" Version="1.6.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PhoenixmlDb.XQuery" Version="1.6.14" />
                    
Directory.Packages.props
<PackageReference Include="PhoenixmlDb.XQuery" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PhoenixmlDb.XQuery --version 1.6.14
                    
#r "nuget: PhoenixmlDb.XQuery, 1.6.14"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PhoenixmlDb.XQuery@1.6.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PhoenixmlDb.XQuery&version=1.6.14
                    
Install as a Cake Addin
#tool nuget:?package=PhoenixmlDb.XQuery&version=1.6.14
                    
Install as a Cake Tool

PhoenixmlDb.XQuery

XQuery 4.0 query engine for PhoenixmlDb — query XML and JSON documents with the full power of XQuery.

Features

  • Full XQuery 4.0 — FLWOR expressions, constructors, modules, user-defined functions
  • XPath 4.0 — complete XPath implementation with 240+ built-in functions
  • JSON supportjson-doc(), parse-json(), maps, arrays — query JSON natively
  • Full-text searchft:contains() with stemming, wildcards, proximity, scoring
  • Update Facility — insert, delete, replace, rename, transform expressions
  • Type system — records, enums, union types (XQuery 4.0)

Quick example

using PhoenixmlDb.XQuery.Execution;

var engine = new QueryEngine();

// Simple query
var results = engine.ExecuteToListAsync(
    "for $x in 1 to 10 where $x mod 2 = 0 return $x * $x");

// Query XML documents
var books = engine.ExecuteAsync(
    "//book[price > 30]/title",
    containerId);
Package Description
PhoenixmlDb.Core Core types and XDM data model (dependency)
PhoenixmlDb.Xslt XSLT 4.0 transformation engine
PhoenixmlDb.XQuery.Cli xquery command-line tool

Documentation

Full documentation at phoenixml.dev

License

Apache 2.0

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on PhoenixmlDb.XQuery:

Package Downloads
PhoenixmlDb.Xslt

XSLT 4.0 transformation engine for PhoenixmlDb

Phoenixml.Platform.Editor.Xml

XML/XSD vocabulary binding for Phoenixml.Platform — concrete IDocument and ITreeNodeProvider implementations against PhoenixmlDb.Core's XDM, XSD schema validation pipeline.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 0 9/15/2026
1.8.0 178 9/14/2026
1.7.0 587 9/11/2026
1.6.15 134 9/9/2026
1.6.14 162 9/7/2026
1.6.13 145 9/4/2026
1.6.12 171 9/1/2026
1.6.11 146 8/29/2026
1.6.10 172 8/29/2026
1.6.9 229 8/27/2026
1.6.8 163 8/26/2026
1.6.7 169 8/24/2026
1.6.6 155 8/23/2026
1.6.5 150 8/21/2026
1.6.2 187 8/16/2026
1.6.1 199 7/31/2026
1.6.0 174 7/27/2026
1.5.5 201 7/12/2026
1.5.4 202 7/9/2026
1.5.3 150 7/8/2026
Loading failed

Error codes. Four sites where the engine knew exactly what had gone wrong and reported something
a caller could not act on — three of them by letting a raw .NET exception escape.

### Casting and constructor functions leaked CLR exceptions

`xs:int('abc')` reported *"The input string 'abc' was not in a correct format."* That is a
`FormatException`, not an XQuery error, and it matches no error code any caller could catch on.
The conversion primitives underneath — `Convert.To*`, `*.Parse` — throw `FormatException`,
`OverflowException` and `InvalidCastException`, and those travelled all the way out.

The spec defines a constructor function as equivalent to a cast, so `xs:int('abc')` and
`'abc' cast as xs:int` must report the same code. Only the cast half had been wrapped; the 49
constructor functions called `long.Parse` and `Convert.ToInt32` directly. Both halves now
translate consistently: an invalid lexical form is FORG0001, a value out of range is FOCA0002, an
operand whose type has no conversion at all is XPTY0004.

The mapping was measured against the W3C corpus rather than assumed. In cast and constructor
context `FormatException` corresponds to FORG0001 in 57 of 57 cases; `OverflowException` splits
78 to 29 in favour of FOCA0002, so that is a majority answer rather than a certainty, and the
minority remain wrong — with a proper code — until the split is understood.

Both wrappers sit in the shared helper rather than at the call sites, because every call site is
an `async IAsyncEnumerable` iterator and C# forbids `yield return` inside a `try` with a `catch`.
That constraint is the likeliest reason this was never wrapped.

### Casting to a gregorian type accepted operands the spec forbids

XQuery §19.1 permits casting to `xs:gYear` and its relatives only from `xs:string`,
`xs:untypedAtomic`, `xs:date`, `xs:dateTime` or the same gregorian type. The default arm of each
dispatch instead stringified whatever it received and handed the text to the lexical parser, so
`xs:time("13:20:00-05:00") cast as xs:gYear` reported `Invalid xs:gYear: '13:20:00-05:00'` —
diagnosing a malformed lexical form for a cast that was never legal. Now XPTY0004.

### fn:avg disagreed with fn:sum about its own operand types

`fn:sum` raises FORG0006 for boolean, string, anyURI and duration operands. `fn:avg` agreed only
on string and used XPTY0004 for boolean and anyURI — inconsistent with its twin three lines away
in the same file. `fn:avg` also crashed outright on an `xs:integer` outside `long` range:
`BigInteger` does not implement `IConvertible`, and the accumulation ended in an unconditional
`Convert.ToDouble` outside its `else if` chain. `fn:sum` was unaffected; its chain is closed.

### fn:load-xquery-module reported FOQM0002 for every failure

The implementation compiles a synthetic `import module`, so the analyzer has already classified
the failure precisely — an unresolvable module namespace is XQST0059. The wrapper discarded that
and reported FOQM0002 for everything, making "no such module", "the module has a syntax error" and
"the module imports something missing" indistinguishable.

Static errors surfaced through `XQueryFacade` and the `xquery` CLI had the same shape, reporting a
blanket XPST0003 — a syntax error — for any compilation failure, while `QueryEngine.Compile` had
always propagated the analyzer's own code.

### Measured

W3C XQTS 28,887 → **29,205 of 31,414 (92.97%)**. Unit suite 1532, unchanged.

The denominator moved too, and not because tests were dropped for convenience: the runner accepted
any `<dependency type="spec">` containing "XQ", so tests pinned to **XQuery 1.0** ran against a 4.0
engine. `Axes127` states in its own description that "the namespace-node() kind test is new in
XQuery 3.0" and asserts an error — it requires the engine NOT to support something this engine
does support. 56 such tests are now correctly skipped.

### Source layout

No behaviour change: 31 files carrying five or more top-level types are now one type per file,
including `PhysicalOperators.cs` (89 types, 12,879 lines). Verified by diffing the full type
inventory before and after — 890 types, none lost, none added.