All Projects → YAXLib → Yaxlib

YAXLib / Yaxlib

Licence: mit
Yet Another XML Serialization Library for the .NET Framework and .NET Core

Projects that are alternatives of or similar to Yaxlib

Lora Serialization
LoraWAN serialization/deserialization library for The Things Network
Stars: ✭ 120 (-3.23%)
Mutual labels:  serialization-library, serialization, deserialization
Go
A high-performance 100% compatible drop-in replacement of "encoding/json"
Stars: ✭ 10,248 (+8164.52%)
Mutual labels:  serialization, deserialization
Hprose Golang
Hprose is a cross-language RPC. This project is Hprose for Golang.
Stars: ✭ 1,143 (+821.77%)
Mutual labels:  serialization-library, serialization
Yyjson
The fastest JSON library in C
Stars: ✭ 1,894 (+1427.42%)
Mutual labels:  serialization, deserialization
Restfulsense
A RESTFul operations client that serializes responses and throws meaningful exceptions for >= 400 status codes.
Stars: ✭ 28 (-77.42%)
Mutual labels:  serialization, deserialization
Eminim
JSON serialization framework for Nim, works from a Stream directly to any type and back. Depends only on stdlib.
Stars: ✭ 32 (-74.19%)
Mutual labels:  serialization-library, serialization
Edn format
EDN reader and writer implementation in Python, using PLY (lex, yacc)
Stars: ✭ 92 (-25.81%)
Mutual labels:  serialization, deserialization
Bluecap
iOS Bluetooth LE framework
Stars: ✭ 669 (+439.52%)
Mutual labels:  serialization, deserialization
Hprose Delphi
Hprose is a cross-language RPC. This project is Hprose 2.0 for Delphi and FreePascal
Stars: ✭ 100 (-19.35%)
Mutual labels:  serialization-library, serialization
Loopback Component Jsonapi
JSONAPI support for loopback.
Stars: ✭ 104 (-16.13%)
Mutual labels:  serialization, deserialization
Typical
Typical: Fast, simple, & correct data-validation using Python 3 typing.
Stars: ✭ 111 (-10.48%)
Mutual labels:  serialization, deserialization
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (+0%)
Mutual labels:  serialization, deserialization
Jackson Module Kotlin
Module that adds support for serialization/deserialization of Kotlin (http://kotlinlang.org) classes and data classes.
Stars: ✭ 830 (+569.35%)
Mutual labels:  serialization, deserialization
Beeschema
Binary Schema Library for C#
Stars: ✭ 46 (-62.9%)
Mutual labels:  serialization, deserialization
Iod
Meta programming utilities for C++14. Merged in matt-42/lithium
Stars: ✭ 731 (+489.52%)
Mutual labels:  serialization, deserialization
Java
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Stars: ✭ 1,308 (+954.84%)
Mutual labels:  serialization, deserialization
Bridge Deprecated
[DEPRECATED]: Prefer Retrofit/OkHttp by Square, or Fuel for Kotlin
Stars: ✭ 624 (+403.23%)
Mutual labels:  serialization, deserialization
Marshmallow
A lightweight library for converting complex objects to and from simple Python datatypes.
Stars: ✭ 5,857 (+4623.39%)
Mutual labels:  serialization, deserialization
Succ
Sexy and Utilitarian Code Configuration
Stars: ✭ 100 (-19.35%)
Mutual labels:  serialization-library, serialization
Seriality
Seriality is a library for serializing and de-serializing all the Solidity types in a very efficient way which mostly written in solidity-assembly
Stars: ✭ 105 (-15.32%)
Mutual labels:  serialization-library, deserialization

YAXLib Logo

YAXLib: Yet Another XML Serialization Library

AppVeyor build status windows AppVeyor build status linux codecov NuGet

YAXLib is a flexible XML serialization library that lets developers design freely the XML file structure, choose among private and public fields to be serialized, and serialize all known collection classes and arrays (single-dimensional, multi-dimensional, and jagged arrays) in the .NET Framework.

YAXLib can be used as a powerful XML parser or generator, that exploits the object to XML mapping in the class definitions themselves.

The exception handling policies and its missing data recovery capabilities makes YAXLib a reliable tool for XML configuration storage and retrieval.

Features

  • Allowing the programmer to format the XML result as desired
  • Support for specifying path-like serialization addresses, e.g., elem1/elem2/elem3, and ../elem1, and ./elem1
  • Support for XML namespaces
  • Serialization and deserialization of all known generic and non-generic collection classes in System.Collections, and System.Collections.Generic
  • Support for serialization of single-dimensional, multi-dimensional, and jagged arrays
  • Support for recursive serialization of collections (i.e., collection of collections)
  • Support for specifying aliases for enum members
  • Support for defining user-defined custom serializer for specific types or specific fields
  • Allowing the programmer to choose the fields to serialize (public, or non-public properties, or member variables)
  • Support for serialization and deserialization of objects through a reference to their base-class or interface (also known as polymorphic serialization)
  • Support for multi-stage deserialization
  • Allowing the programmer to add comments for the elements in the XML result
  • and more ...

See the accompanied demo application for an example of each functionality.

Documentation

In the first place please have a look at the YAXLib Wiki. It is a good source to start. The next best documentation for YAXLib is its various samples and unit-tests in this repo.

To play with sample classes, open one of the solution files in Visual Studio, go to YAXLibTests project, SampleClasses folder. If you want a sample class to appear in the demo application simply put a [ShowInDemoApplication] attribute on top of the class definition. In the demo application you can see the serialization result, modify it, and test its deserialization.

Nuget

To install YAXLib, run the following command in the Package Manager Console:

PM> Install-Package YAXLib

A Quick Introduction

Imagine that we have a simple Warehouse class with the following definition:

public class Warehouse
{
    public class Person
    {
        public string SSN { get; set; }
        public string Name { get; set; }
        public string Family { get; set; }
        public int Age { get; set; }
    }

    public string Name { get; set; }
    public string Address { get; set; }
    public double Area { get; set; }
    public List<string> Items { get; set; }
    public Dictionary<string, int> ItemQuantitiesDic { get; set; }
    public Person Owner { get; set; }
}

Without adding any attributes, YAXLib is perfectly capable of serializing objects of the above class. The following is an XML serialization of a sample instantiation of our Warehouse class:

<Warehouse>
  <Name>Foo Warehousing Ltd.</Name>
  <Address>No. 10, Some Ave., Some City, Some Country</Address>
  <Area>120000.5</Area>
  <Items>
    <String>Bicycle</String>
    <String>Football</String>
    <String>Shoe</String>
    <String>Treadmill</String>
  </Items>
  <ItemQuantitiesDic>
    <KeyValuePairOfStringInt32>
      <Key>Bicycle</Key>
      <Value>10</Value>
    </KeyValuePairOfStringInt32>
    <KeyValuePairOfStringInt32>
      <Key>Football</Key>
      <Value>120</Value>
    </KeyValuePairOfStringInt32>
    <KeyValuePairOfStringInt32>
      <Key>Shoe</Key>
      <Value>600</Value>
    </KeyValuePairOfStringInt32>
    <KeyValuePairOfStringInt32>
      <Key>treadmill</Key>
      <Value>25</Value>
    </KeyValuePairOfStringInt32>
  </ItemQuantitiesDic>
  <Owner>
    <SSN>123456789</SSN>
    <Name>John</Name>
    <Family>Doe</Family>
    <Age>50</Age>
  </Owner>
</Warehouse>

It's good to have it serialized this simple, but YAXLib can do more than that. Let's do some house-keeping on the XML side. Let's move the XML-elements and attributes around, so that we will have a nicer and more human readable XML file. Let's decorate our Warehouse class with the following YAXLib attributes and see the XML result.

[YAXComment("Watch it closely. It's awesome, isn't it!")]
public class Warehouse
{
    public class Person
    {
        [YAXAttributeFor("..")]
        [YAXSerializeAs("OwnerSSN")]
        public string SSN { get; set; }

        [YAXAttributeFor("Identification")]
        public string Name { get; set; }

        [YAXAttributeFor("Identification")]
        public string Family { get; set; }

        public int Age { get; set; }
    }

    [YAXAttributeForClass]
    public string Name { get; set; }

    [YAXSerializeAs("address")]
    [YAXAttributeFor("SiteInfo")]
    public string Address { get; set; }

    [YAXSerializeAs("SurfaceArea")]
    [YAXElementFor("SiteInfo")]
    public double Area { get; set; }

    [YAXCollection(YAXCollectionSerializationTypes.Serially, SeparateBy = ", ")]
    [YAXSerializeAs("AvailableItems")]
    public List<string> Items { get; set; }

    [YAXDictionary(EachPairName = "ItemInfo", KeyName = "Item", ValueName = "Count",
                    SerializeKeyAs = YAXNodeTypes.Attribute,
                    SerializeValueAs = YAXNodeTypes.Attribute)]
    [YAXCollection(YAXCollectionSerializationTypes.RecursiveWithNoContainingElement)]
    [YAXSerializeAs("ItemQuantities")]
    public Dictionary<string, int> ItemQuantitiesDic { get; set; }

    public Person Owner { get; set; }
}

And this is the result of XML serialization:

<!-- Watch it closely. It's awesome, isn't it! -->
<Warehouse Name="Foo Warehousing Ltd." OwnerSSN="123456789">
  <SiteInfo address="No. 10, Some Ave., Some City, Some Country">
    <SurfaceArea>120000.5</SurfaceArea>
  </SiteInfo>
  <AvailableItems>Bicycle, Football, Shoe, Treadmill</AvailableItems>
  <ItemInfo Item="Bicycle" Count="10" />
  <ItemInfo Item="Football" Count="120" />
  <ItemInfo Item="Shoe" Count="600" />
  <ItemInfo Item="treadmill" Count="25" />
  <Owner>
    <Identification Name="John" Family="Doe" />
    <Age>50</Age>
  </Owner>
</Warehouse>

Contributors

Logo

Logo designed by axuno gGmbH

License

Copyright (c) 2009 - 2021 Sina Iravanian, Julian Verdurmen, axuno gGmbH and other contributors - Licenced under MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].