Migrating from System.Xml
Keep established calling patterns where they fit, and introduce new capabilities deliberately.
On this page
Start at the call site
For XSLT 1.0, the compatibility facade offers the familiar Load and Transform pattern. An alias lets you isolate the change in a small part of the application.
using Transform =
DCoding.Xml.Xslt.Compatibility.XslCompiledTransform;
var transform = new Transform();
transform.Load(stylesheetReader);
transform.Transform(inputReader, outputWriter);Check your integration contract
A similar API reduces migration work but does not replace application testing. Test representative stylesheets, parameters, output settings, resolver rules and error handling. Compatibility is assessed using tests ported from dotnet/runtime as well as the product’s own suites.
- Capture expected results before switching.
- Replace the implementation at a bounded call site.
- Compare output semantics and application error handling.
- Enable additional language features as a separate step.
Keep LINQ to XML in your application
You can keep building documents with XDocument and XElement and pass them to the query APIs. This makes a gradual introduction possible without replacing your entire document construction code.