The ChannelAdam XML Library

Overview

An open source, .NET Standard 2.0 library that provides helpful XML functionality that makes XML validation, serialisation and type conversion easy.

Below are the main features of the library. See the linked code for details.

Please contact me if you have any questions.

Getting Started

NuGet Package Installation

To install the ChannelAdam.Xml NuGet package run the following command in the Package Manager Console:

1PM> Install-Package ChannelAdam.Xml

Usage

 1using ChannelAdam.Xml;
 2...
 3
 4    [XmlRoot(Namespace = "uri:normal:namespace")]
 5    public class ObjectForXmlStuff
 6    {
 7        public string MyStringProperty { get; set; }
 8
 9        [XmlElement(Namespace = "uri:different:namespace")]
10        public string MyStringPropertyWithDifferentNamespace { get; set; }
11
12        public int MyIntProperty { get; set; }
13    }
14
15    public class Stuff
16    {
17        public void SerialiseAndDeserialseXml()
18        {
19            var xmlObject = new ObjectForXmlStuff();
20            xmlObject.MyStringProperty = "hello";
21
22            string xml = xmlObject.SerialiseToXml();
23
24            var xmlObject2 = xml.DeserialiseFromXml<ObjectForXmlStuff>();
25        }
26    }

See XmlSerialisationUnitTestSteps.cs for more examples.

Reference

Please leave below any comments, feedback or suggestions, or alternatively contact me on a social network.

comments powered by Disqus