Click here to Skip to main content
12,456,128 members (54,434 online)
Click here to Skip to main content
Articles » Languages » XML » Serializing » Downloads

Stats

202.1K views
269 downloads
205 bookmarked
Posted

Yet Another XML Serialization Library for the .NET Framework

, 2 Oct 2012 MIT
A flexible XML serialization library that lets developers design the XML file structure, and select the exception handling policy. YAXLib supports polymorphic serialization and serializing generic and non-generic collection classes and arrays.
YAXLib
DemoApplication
Properties
SampleClasses
YAXLib
Properties
LocalTestRun.testrunconfig
YAXLib.vsmdi
YAXLibTests
Properties
Test References
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YAXLib;

namespace DemoApplication.SampleClasses
{
    [YAXSerializeAs("Pricing")]
    public class Request
    {
        public Request()
        { }

        [YAXAttributeForClass()]
        public string id { get; set; }

        [YAXAttributeFor("version")]
        public string major { get; set; }

        [YAXAttributeFor("version")]
        public string minor { get; set; }

        [YAXSerializeAs("value_date")]
        [YAXElementFor("input")]
        public string valueDate { get; set; }

        [YAXSerializeAs("storage_date")]
        [YAXElementFor("input")]
        public string storageDate { get; set; }

        [YAXSerializeAs("user")]
        [YAXElementFor("input")]
        public string user { get; set; }

        //[YAXElementFor("input")]
        //public string skylab_config { get; set; }

        //[YAXElementFor("skylab_config")]
        //public string job { get; set; }

        [YAXElementFor("input")]
        [YAXSerializeAs("skylab_config")]
        public SkyLabConfig Config { get; set; }

        internal static Request GetSampleInstance()
        {
            return new Request()
            {
                id = "123",
                major = "1",
                minor = "0",
                valueDate = "2010-10-5",
                storageDate = "2010-10-5",
                user = "me",
                Config = new SkyLabConfig() { Config = "someconf", Job = "test" }
            };
        }

        public override string ToString()
        {
            return GeneralToStringProvider.GeneralToString(this);
        }
    }

    public class SkyLabConfig
    {
        [YAXSerializeAs("SomeString")]
        public string Config { get; set; }

        [YAXSerializeAs("job")]
        public string Job { get; set; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License

Share

About the Author

Sina Iravanian
Software Developer
Australia Australia
A software designer and developer

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160826.1 | Last Updated 2 Oct 2012
Article Copyright 2009 by Sina Iravanian
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid