Skip to main content
net10.0net11.0net8.0net9.0

Immutable XML syntax tree with diagnostics, editing helpers, and XPath navigation.

Published
Jun 13, 2026
4mo ago
Total Downloads
575
575

Deprecated Package Version

Reason: Legacy

Package was renamed

Suggested alternative:Meziantou.Framework.Language.Xml*

Install

dotnet add package Meziantou.Framework.Xml --version 1.0.1
ProductVersions
.NET
net10.0net11.0net8.0net9.0

README

Meziantou.Framework.Xml

Meziantou.Framework.Xml provides immutable XML syntax tree APIs focused on roundtrip-safe XML processing:

  • parse XML into a syntax tree without reformatting it
  • navigate/query nodes with XPath
  • edit targeted nodes
  • save back while preserving untouched text and formatting
  • support for XML namespaces in queries and edits
  • support invalid XML documents (for example with unclosed tags) and report diagnostics
using System.Xml;
using Meziantou.Framework.Xml;

const string xml = "<root><item version='1.0.0' /></root>";

var tree = XmlSyntaxTree.ParseText(xml);

// Navigate the tree
tree.Root.DescendantNodes().OfType<XmlAttributeSyntax>().First().Value;

// Navigate the tree with XPath
var itemNode = tree.Root.SelectSingleNode("//item");

// Update a node
var updatedRoot = tree.Root.ReplaceNode(
    itemNode,
    XmlSyntaxFactory.Element("newItem").WithAttribute("version", "2.0.0"));

// Update the tree with XPath
var updatedRoot = tree.Root.ReplaceNode(
    "//item/@version",
    node => ((XmlAttributeSyntax)node).WithValue("2.0.0"));

// Get the updated XML
var updatedXml = updatedRoot.ToFullString();

Changes from Previous Version

No structural changes between v1.0.0 and v1.0.1.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

NuGet marks this package as deprecated and points to Meziantou.Framework.Language.Xml as an alternative.Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.