PhoenixmlDb.Core
2.3.0
dotnet add package PhoenixmlDb.Core --version 2.3.0
NuGet\Install-Package PhoenixmlDb.Core -Version 2.3.0
<PackageReference Include="PhoenixmlDb.Core" Version="2.3.0" />
<PackageVersion Include="PhoenixmlDb.Core" Version="2.3.0" />
<PackageReference Include="PhoenixmlDb.Core" />
paket add PhoenixmlDb.Core --version 2.3.0
#r "nuget: PhoenixmlDb.Core, 2.3.0"
#:package PhoenixmlDb.Core@2.3.0
#addin nuget:?package=PhoenixmlDb.Core&version=2.3.0
#tool nuget:?package=PhoenixmlDb.Core&version=2.3.0
PhoenixmlDb.Core
Core types, interfaces, and XDM (XQuery Data Model) implementation for PhoenixmlDb — a modern embedded XML/JSON document database for .NET.
What's in this package
- Database interfaces —
IDocumentDatabase,IContainer,IDocumentfor storing and retrieving XML/JSON documents - XDM node types —
XdmElement,XdmAttribute,XdmDocument, etc. — the W3C XQuery Data Model - Transaction model —
IReadTransaction,IWriteTransactionwith MVCC snapshot isolation - Index configuration — path, value, full-text, and metadata indexes for fast queries
- XML parser and serializer — parse XML into XDM trees and serialize back
- Atomic value types — dates, times, durations, and other XSD types with correct semantics
When to use this package
Directly: If you're building a storage provider, query engine integration, or tooling that works with XDM types.
Indirectly: This package is a dependency of PhoenixmlDb.XQuery, PhoenixmlDb.Xslt, and the CLI tools. You typically don't reference it alone unless you need the core types without query/transform capabilities.
Quick example
using PhoenixmlDb.Core;
using PhoenixmlDb.Xdm.Parsing;
// Parse XML into an XDM tree
var parser = new XmlDocumentParser();
var result = parser.Parse("<order><item>Widget</item></order>");
var doc = result.Document;
// Navigate the tree
var root = doc.Children[0]; // <order> element
Console.WriteLine(root.StringValue); // "Widget"
Related packages
| Package | Description |
|---|---|
| PhoenixmlDb.XQuery | XQuery 4.0 query engine |
| PhoenixmlDb.Xslt | XSLT 4.0 transformation engine |
| PhoenixmlDb.XQuery.Cli | xquery command-line tool |
| PhoenixmlDb.Xslt.Cli | xslt command-line tool |
Documentation
Full documentation at phoenixml.dev
License
Apache 2.0
| Product | Versions 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on PhoenixmlDb.Core:
| Package | Downloads |
|---|---|
|
PhoenixmlDb.XQuery
XQuery 4.0 query engine for PhoenixmlDb |
|
|
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.3.0 | 0 | 10/8/2026 |
| 2.2.0 | 85 | 10/6/2026 |
| 2.1.0 | 151 | 10/5/2026 |
| 2.0.0 | 1,649 | 9/15/2026 |
| 1.7.0 | 942 | 9/11/2026 |
| 1.6.7 | 889 | 8/24/2026 |
| 1.6.6 | 195 | 8/23/2026 |
| 1.6.5 | 193 | 8/21/2026 |
| 1.6.0 | 171 | 8/7/2026 |
| 1.5.0 | 127 | 8/6/2026 |
| 1.4.0 | 117 | 8/4/2026 |
| 1.3.0 | 372 | 7/27/2026 |
| 1.2.2 | 307 | 7/9/2026 |
| 1.2.1 | 169 | 7/8/2026 |
| 1.2.0 | 340 | 6/28/2026 |
| 1.1.9 | 339 | 6/17/2026 |
| 1.1.8 | 219 | 6/14/2026 |
| 1.1.7 | 148 | 6/9/2026 |
| 1.1.6 | 126 | 6/9/2026 |
| 1.1.5 | 331 | 5/23/2026 |
Minor because it adds API. Nothing changes for existing callers.
- **New: the shared schema layer, `PhoenixmlDb.Core.Schema`.** One place to load, compile, cache
and validate against XSD schemas, so that every consumer resolves, caches, restricts and reports
the same way. This release adds the layer. PhoenixmlDb.XQuery reads all its schema documents
through it from its next release.
- **`SchemaSource`**: a schema document the host supplies. `FromText(text, uri)`,
`FromResource(assembly, name, uri)`, `FromStore(uri, open, version)`. Always named by an
absolute URI; text with a relative URI is an `ArgumentException` rather than a resolve against
the current directory. Each carries a version token (a content hash, or the store's version
id).
- **`ISchemaAccessGate`**: the one route by which any other schema document is read: a root
named by URI and every `xs:include`, `xs:import` and `xs:redefine`. `OpenAsync` and
`GetVersionAsync` both receive the absolute URI, the location as it was written, and the
referring document. Nothing in the layer opens a file or a connection itself.
`SchemaAccessGate.SuppliedOnly` admits nothing; `SchemaAccessGate.LocalFiles(roots…)` admits
files under the given directories, decided on the path of the opened file on Linux and
Windows; on other platforms it refuses any path with a symbolic link below a root. **The roots
must be writable only by the operator.** There is no gate that fetches from the network; a
host that wants one supplies it.
- **`SchemaCompiler.CompileAsync`** (and a blocking `Compile`) reads the whole closure first,
each document once, then compiles from memory and fetches nothing while compiling. It returns
a `CompiledSchema`: the compiled `XmlSchemaSet`, and every document of the closure with the
version compiled.
- **`SchemaCache`**: keeps compiled schemas until **any** document of their closure changes,
not only a root. `CheckInterval` (30 s by default; zero asks on every use; infinite never
asks), `Invalidate(uri)`, `Clear()`, at most 256 schemas, least recently used out first.
Requests that arrive together compile once; a failed compilation is not kept.
`SchemaCache.Default` is shared; a host can make its own.
- **`SchemaValidator.Validate`**: one call, one result: `IsValid`, the diagnostics in document
order, and `Truncated` when validation stopped early.
- **`SchemaDiagnostic`**: severity, message, source URI, line, column, for compilation and
validation alike. `SchemaCompilationException` carries them. A validation error also has
`Code`, the XSD validation rule it reports (`cvc-complex-type.2.4.a`, `cvc-pattern-valid`),
and `MessageId`, the schema processor's own name for the message, which is the same for every
diagnostic of one kind whatever its text says. Both come from which message System.Xml raised,
never from the wording of a message. A message that covers two rules (a duplicate key and a
duplicate unique value; an abstract element and an abstract type) has an id and no code. Both
are `null` on a runtime where System.Xml's private state cannot be read, and the ids are
System.Xml's names, not a contract of this library.
- **`XmlCatalog`**: OASIS XML Catalogs 1.1, every entry of it (`uri`, `system`, `public`,
`rewriteURI`, `rewriteSystem`, `uriSuffix`, `systemSuffix`, `delegateURI`, `delegateSystem`,
`delegatePublic`, `group`, `nextCatalog`, with `xml:base` and `prefer`), set through
`SchemaCompileOptions.Catalog`. Names compare after the specification's URI normalization,
and a `urn:publicid:` name is read as the public identifier it stands for. A catalog only
renames: what it maps a name to is still read from a source or through the gate. A catalog
that an entry delegates to is read when the catalog is loaded, not at the first lookup.
**Defaults that are stricter than a bare `XmlSchemaSet` or validating reader:**
- A referenced schema document that cannot be read **fails the compilation**. System.Xml
reports it as a warning and compiles what is left, so an `xs:import` nothing else used
compiled silently without it.
- A schema document may not have a document type declaration, and may not nest deeper than 512
levels.
- Validation: the document element **must be declared by the schema** (`RequireDeclaredRoot`).
System.Xml says nothing about an element it has no declaration for, so a document validated
against a schema for another vocabulary was reported valid. `xsi:schemaLocation` and inline
schemas in the instance are never followed, and the instance may not have a document type
declaration.
- A cached schema is given to a request only after that request's own gate has admitted every
document of it. A gate object that the cache has not seen is always asked first; after that
its answer holds for one `CheckInterval`. A host that uses one gate object for many requests
and needs a withdrawn permission to take effect at once sets `CheckInterval` to
`TimeSpan.Zero`.
**Limits** (`SchemaCompileOptions`, all settable): 16 MiB for one schema document, 64 MiB for
one compilation, 1,024 documents. No more than the limit is taken from any stream. Validation:
1,000 diagnostics; no depth limit unless the host sets `MaxDepth`. A catalog: 64 files.
**Pattern facets.** `SchemaCompileOptions.PatternMatchTimeout` bounds one match of an
`xs:pattern` facet, in compilation and in every validation against the compiled schema. It is
off by default (`null`). With it, a schema whose own enumeration, default or fixed values run
past the limit does not compile, and a validation that runs past it stops with
`PatternTimedOut` (and `Truncated`) set. A host that compiles schemas or validates documents it
does not trust should set it. It reaches System.Xml's compiled expressions through private
state; on a runtime where that is not possible, a schema that declares a pattern does not
compile with a limit set, instead of being left unbounded.
**XSD 1.1.** The processor is System.Xml's, which implements XSD 1.0. With
`Xsd11Compatibility` (on by default) the parts a schema marks as 1.1-only with `vc:` attributes
are left out, as XSD 1.1 §4.2.2 says a 1.0 processor is to, and `xs:dayTimeDuration`,
`xs:yearMonthDuration` and `xs:dateTimeStamp` are read as the 1.0 types they restrict. The 1.1
type's own constraint is not applied: an `xs:dayTimeDuration` of `P1Y` is accepted.
**Known gaps:**
- A `CompiledSchema` is not opaque: its `XmlSchemaSet` exposes every declaration, and
`Documents` lists each document's URI. A host that must keep those from the code it runs
keeps the object to itself.