Dandraka.XmlUtilities 1.1.0

Additional Details

Version 1.1 has many bugs when parsing complex xml; these have been solved in versions >= 1.2. Versions 1.2.x are completely backwards compatible with 1.0 & 1.1, so it's highly recommended to upgrade.

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dandraka.XmlUtilities --version 1.1.0
NuGet\Install-Package Dandraka.XmlUtilities -Version 1.1.0
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="Dandraka.XmlUtilities" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dandraka.XmlUtilities --version 1.1.0
#r "nuget: Dandraka.XmlUtilities, 1.1.0"
#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.
// Install Dandraka.XmlUtilities as a Cake Addin
#addin nuget:?package=Dandraka.XmlUtilities&version=1.1.0

// Install Dandraka.XmlUtilities as a Cake Tool
#tool nuget:?package=Dandraka.XmlUtilities&version=1.1.0


An XmlSlurper implementation for .Net. The idea came from Groovy's XmlSlurper which is hugely useful.

What this does, is convert a piece of xml, e.g.

<card xmlns="http://businesscard.org">
   <name>John Doe</name>
   <title>CEO, Widget Inc.</title>
   <phone>(202) 456-1414</phone>
   <logo url="widget.gif"/>

to a C# object, e.g.


This is done without any need to declare the type (it actually uses System.Dynamic.ExpandoObject behind the scenes).

Under the Release tab you can find the binaries to download.


using Dandraka.XmlUtilities;

public void PrintXmlContents1()
	string xml = "<book id=\"bk101\" isbn=\"123456789\"><author>Gambardella, Matthew</author><title>XML Developer Guide</title></book>";
	var book = XmlSlurper.ParseText(xml);

	// that's it, now we have everything
	Console.WriteLine("id = " + book.id);
	Console.WriteLine("isbn = " + book.isbn);
	Console.WriteLine("author = " + book.author);
	Console.WriteLine("title = " + book.title);

public void PrintXmlContents2()
	string xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" +
				 "<nutrition>" +
				 "	<food>" +
				 "		<name>Avocado Dip</name>" +
				 "		<mfr>Sunnydale</mfr>" +
				 "		<carb>2</carb>" +
				 "		<fiber>0</fiber>" +
				 "		<protein>1</protein>" +
				 "	</food>" +
				 "	<food>" +
				 "		<name>Bagels, New York Style </name>" +
				 "		<mfr>Thompson</mfr>" +
				 "		<carb>54</carb>" +
				 "		<fiber>3</fiber>" +
				 "		<protein>11</protein>" +
				 "	</food>" +
				 "	<food>" +
				 "		<name>Beef Frankfurter, Quarter Pound </name>" +
				 "		<mfr>Armitage</mfr>" +
				 "		<carb>8</carb>" +
				 "		<fiber>0</fiber>" +
				 "		<protein>13</protein>" +
				 "	</food>" +
	var nutrition = XmlSlurper.ParseText(xml);

	// since many food nodes were found, a list was generated and named foodList (common name + "List")
	Console.WriteLine("name1 = " + nutrition.foodList[0].name);
	Console.WriteLine("name2 = " + nutrition.foodList[1].name);


The first production-ready release was uploaded. Please see the release page for a known bug.


Although not required by the license, the author kindly asks that you share any improvements you made.

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. 
.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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 1,868 1/3/2021
1.2.1 22,808 11/14/2019
1.2.0 635 11/14/2019
1.1.0 646 8/22/2019

Release 1.1 was converted from .Net Framework to .Net Standard (and tests to .Net core), in order to be as portable as possible.