MapXML 0.3.4-Beta-debug

This is a prerelease version of MapXML.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MapXML --version 0.3.4-Beta-debug
                    
NuGet\Install-Package MapXML -Version 0.3.4-Beta-debug
                    
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="MapXML" Version="0.3.4-Beta-debug" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MapXML" Version="0.3.4-Beta-debug" />
                    
Directory.Packages.props
<PackageReference Include="MapXML" />
                    
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 MapXML --version 0.3.4-Beta-debug
                    
#r "nuget: MapXML, 0.3.4-Beta-debug"
                    
#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 MapXML@0.3.4-Beta-debug
                    
#: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=MapXML&version=0.3.4-Beta-debug&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MapXML&version=0.3.4-Beta-debug&prerelease
                    
Install as a Cake Tool

MapXML

MapXML is a lightweight .NET library designed for mapping and transforming XML structures into strongly-typed objects and vice-versa. It provides a framework for defining XML structure, resolving types, and performing automated parsing and object instantiation.

Projects

  • MapXML — Core library
  • MapXML.Samples — Samples collection, still a work in progress
  • MapXML.Test — Unit test suite using MSTest

📦 Getting Started

To use MapXML in your project you can either install through NuGet

dotnet add package MapXML

or clone and compile along with your project :

git clone https://github.com/LongJSilver/MapXML.git

Sample Use Case

Below is an example that shows a small XML document and its corresponding C# object graph.

Example XML

<Library>
  <Book ISBN="9783161484100">
    <Title>The Art of Computer Programming</Title>
    <Author>Donald E. Knuth</Author>
    <PublishedYear>1968</PublishedYear>
  </Book>
  <Book ISBN="9780131103627">
    <Title>The C Programming Language</Title>
    <Author>Brian W. Kernighan &amp; Dennis M. Ritchie</Author>
    <PublishedYear>1978</PublishedYear>
  </Book>
</Library>

CLR Objects

using System.Collections.Generic;

namespace MapXMLExample
{
     public class Library
    {
        // A collection to hold all Book objects
        [XmlChild("Book")]
        public List<Book> Books { get; set; } = new List<Book>();
    }

    public class Book
    {
        // XML attribute mapped to a property
        public string ISBN { get; set; }

        // XML child elements mapped to properties
        public string Title { get; set; }
        public string Author { get; set; }
        public int PublishedYear { get; set; }
    }
}

Deserialization Code

//Define options
IDeserializationOptions opt = 
XMLDeserializer.OptionsBuilder()
    .AllowImplicitFields(true) //<-- Allow implicit fields
    .Build();

//Create a minimal handler to define the root type
var h = new DefaultHandler();
h.Associate("Library", typeof(Library)); //tell the system what 'Library' nodes should map to

// Create an instance of the XMLDeserializer, assuming the XML is stored in the 'xmlString' variable
XMLDeserializer deserializer = new XMLDeserializer(xmlString, Handler:h, Options:opt);
deserializer.Run();

// Get the results
IReadOnlyList<Library> results = h.GetResults<Library>();

📜 License and notes

MapXML is released under Apache 2.0

Despite being released on NuGet it is in the alpha stage, not stable and still subject to frequent breaking changes.
Feedback, suggestions and contributions are welcome.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MapXML:

Package Downloads
Linea

Flexible multi-platform CLI framework and Console utilities

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.3-Beta-debug 39 3/30/2026
0.5.3-Beta 34 3/30/2026
0.3.6-Beta-debug 42 1/18/2026
0.3.6-Beta 38 1/18/2026
0.3.5-Beta-debug 45 1/8/2026
0.3.5-Beta 42 1/8/2026
0.3.4-Beta-debug 130 12/24/2025
0.3.4-Beta 129 12/24/2025
0.2.0-Beta 146 5/20/2025
0.1.0-Alpha 141 4/29/2025