{"id":15039555,"url":"https://github.com/yaxlib/yaxlib","last_synced_at":"2025-05-15T04:07:34.596Z","repository":{"id":3224995,"uuid":"4260350","full_name":"YAXLib/YAXLib","owner":"YAXLib","description":"Yet Another XML Serialization Library for the .NET Framework and .NET Core","archived":false,"fork":false,"pushed_at":"2025-03-14T08:33:42.000Z","size":3388,"stargazers_count":170,"open_issues_count":12,"forks_count":41,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-03T12:06:54.317Z","etag":null,"topics":["deserialization","dot-net","dot-net-core","serialization","serialization-library","xml-serialization"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YAXLib.png","metadata":{"files":{"readme":"ReadMe.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-05-08T12:16:54.000Z","updated_at":"2025-04-02T15:50:08.000Z","dependencies_parsed_at":"2024-07-12T23:59:23.849Z","dependency_job_id":"f18f89b3-db7a-4d20-9560-91fc216351ea","html_url":"https://github.com/YAXLib/YAXLib","commit_stats":{"total_commits":330,"total_committers":17,"mean_commits":19.41176470588235,"dds":0.6212121212121212,"last_synced_commit":"2319aeac856a7850e050a3834840df9aec116622"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YAXLib%2FYAXLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YAXLib%2FYAXLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YAXLib%2FYAXLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YAXLib%2FYAXLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YAXLib","download_url":"https://codeload.github.com/YAXLib/YAXLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248388013,"owners_count":21095324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deserialization","dot-net","dot-net-core","serialization","serialization-library","xml-serialization"],"created_at":"2024-09-24T20:43:16.311Z","updated_at":"2025-04-11T11:45:57.424Z","avatar_url":"https://github.com/YAXLib.png","language":"C#","readme":"![YAXLib Logo](Logo/YAXLib_64x64.png)\n# YAXLib: Yet Another XML Serialization Library\n\n[![AppVeyor build status windows](https://img.shields.io/appveyor/job/build/yaxlib/yaxlib/windows/master?label=windows%20build)](https://ci.appveyor.com/project/yaxlib/yaxlib/branch/master)\n[![AppVeyor build status linux](https://img.shields.io/appveyor/job/build/yaxlib/yaxlib/linux/master?label=linux%20build)](https://ci.appveyor.com/project/yaxlib/yaxlib/branch/master)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=yaxlib_YAXLib\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=yaxlib_YAXLib)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=yaxlib_YAXLib\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=yaxlib_YAXLib)\n[![NuGet](https://img.shields.io/nuget/v/YAXLib.svg)](https://www.nuget.org/packages/YAXLib/)\n\u003c!-- [![NuGet](https://img.shields.io/nuget/vpre/YAXLib.svg)](https://www.nuget.org/packages/YAXLib/) --\u003e\n\n## Project Status: Looking for contributors and maintainers\n\nWe need your help with this project. If you like it, and you are familiar with XML or are willing to help and learn, you can take on different tasks and open pull requests.\n\nWe will continue to provide support for current users and publish bug fix releases as far as time allows.\n\n## About YAXLib\n\n*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. \n\n*YAXLib* can be used as a powerful XML parser or generator, that exploits the object to XML mapping in the class definitions themselves. \n\nThe exception handling policies and its missing data recovery capabilities makes *YAXLib* a reliable tool for XML configuration storage and retrieval.\n\n## Features\n\n* Allowing the programmer to format the XML result as desired\n* Support for specifying path-like serialization addresses, e.g., `elem1/elem2/elem3`, and `../elem1`, and `./elem1`\n* Support for XML namespaces\n* Serialization and deserialization of all known generic and non-generic collection classes in `System.Collections`, and `System.Collections.Generic`\n* Support for serialization of single-dimensional, multi-dimensional, and jagged arrays\n* Support for recursive serialization of collections (i.e., collection of collections)\n* Support for specifying aliases for enum members\n* Support for defining user-defined custom serializer for specific types or specific fields\n* Allowing the programmer to choose the fields to serialize (public, or non-public properties, or member variables)\n* Support for serialization and deserialization of objects through a reference to their base-class or interface (also known as polymorphic serialization)\n* Support for multi-stage deserialization\n* Allowing the programmer to add comments for the elements in the XML result\n* and more ...\n\nSee the accompanied demo application for an example of each functionality. \n\n## Documentation\n\nIn the first place please have a look at the [YAXLib Wiki](https://github.com/YAXLib/YAXLib/wiki). It is a good source to start.\nThe next best documentation for *YAXLib* is its various samples and unit-tests in this repo.\n\nTo 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.\n\n## Nuget\n\nTo install *YAXLib*, run the following command in the *Package Manager Console*:\n\n    PM\u003e Install-Package YAXLib\n\n## A Quick Introduction\n\nImagine that we have a simple `Warehouse` class with the following definition:\n\n```csharp\npublic class Warehouse\n{\n    public class Person\n    {\n        public string SSN { get; set; }\n        public string Name { get; set; }\n        public string Family { get; set; }\n        public int Age { get; set; }\n    }\n\n    public string Name { get; set; }\n    public string Address { get; set; }\n    public double Area { get; set; }\n    public List\u003cstring\u003e Items { get; set; }\n    public Dictionary\u003cstring, int\u003e ItemQuantitiesDic { get; set; }\n    public Person Owner { get; set; }\n}\n```\n\nWithout 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:\n\n```xml\n\u003cWarehouse\u003e\n  \u003cName\u003eFoo Warehousing Ltd.\u003c/Name\u003e\n  \u003cAddress\u003eNo. 10, Some Ave., Some City, Some Country\u003c/Address\u003e\n  \u003cArea\u003e120000.5\u003c/Area\u003e\n  \u003cItems\u003e\n    \u003cString\u003eBicycle\u003c/String\u003e\n    \u003cString\u003eFootball\u003c/String\u003e\n    \u003cString\u003eShoe\u003c/String\u003e\n    \u003cString\u003eTreadmill\u003c/String\u003e\n  \u003c/Items\u003e\n  \u003cItemQuantitiesDic\u003e\n    \u003cKeyValuePairOfStringInt32\u003e\n      \u003cKey\u003eBicycle\u003c/Key\u003e\n      \u003cValue\u003e10\u003c/Value\u003e\n    \u003c/KeyValuePairOfStringInt32\u003e\n    \u003cKeyValuePairOfStringInt32\u003e\n      \u003cKey\u003eFootball\u003c/Key\u003e\n      \u003cValue\u003e120\u003c/Value\u003e\n    \u003c/KeyValuePairOfStringInt32\u003e\n    \u003cKeyValuePairOfStringInt32\u003e\n      \u003cKey\u003eShoe\u003c/Key\u003e\n      \u003cValue\u003e600\u003c/Value\u003e\n    \u003c/KeyValuePairOfStringInt32\u003e\n    \u003cKeyValuePairOfStringInt32\u003e\n      \u003cKey\u003etreadmill\u003c/Key\u003e\n      \u003cValue\u003e25\u003c/Value\u003e\n    \u003c/KeyValuePairOfStringInt32\u003e\n  \u003c/ItemQuantitiesDic\u003e\n  \u003cOwner\u003e\n    \u003cSSN\u003e123456789\u003c/SSN\u003e\n    \u003cName\u003eJohn\u003c/Name\u003e\n    \u003cFamily\u003eDoe\u003c/Family\u003e\n    \u003cAge\u003e50\u003c/Age\u003e\n  \u003c/Owner\u003e\n\u003c/Warehouse\u003e\n```\n\nIt'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.\n\n```csharp\n[YAXComment(\"Watch it closely. It's awesome, isn't it!\")]\npublic class Warehouse\n{\n    public class Person\n    {\n        [YAXAttributeFor(\"..\")]\n        [YAXSerializeAs(\"OwnerSSN\")]\n        public string SSN { get; set; }\n\n        [YAXAttributeFor(\"Identification\")]\n        public string Name { get; set; }\n\n        [YAXAttributeFor(\"Identification\")]\n        public string Family { get; set; }\n\n        public int Age { get; set; }\n    }\n\n    [YAXAttributeForClass]\n    public string Name { get; set; }\n\n    [YAXSerializeAs(\"address\")]\n    [YAXAttributeFor(\"SiteInfo\")]\n    public string Address { get; set; }\n\n    [YAXSerializeAs(\"SurfaceArea\")]\n    [YAXElementFor(\"SiteInfo\")]\n    public double Area { get; set; }\n\n    [YAXCollection(YAXCollectionSerializationTypes.Serially, SeparateBy = \", \")]\n    [YAXSerializeAs(\"AvailableItems\")]\n    public List\u003cstring\u003e Items { get; set; }\n\n    [YAXDictionary(EachPairName = \"ItemInfo\", KeyName = \"Item\", ValueName = \"Count\",\n                    SerializeKeyAs = YAXNodeTypes.Attribute,\n                    SerializeValueAs = YAXNodeTypes.Attribute)]\n    [YAXCollection(YAXCollectionSerializationTypes.RecursiveWithNoContainingElement)]\n    [YAXSerializeAs(\"ItemQuantities\")]\n    public Dictionary\u003cstring, int\u003e ItemQuantitiesDic { get; set; }\n\n    public Person Owner { get; set; }\n}\n```\n\nAnd this is the result of XML serialization:\n\n```xml\n\u003c!-- Watch it closely. It's awesome, isn't it! --\u003e\n\u003cWarehouse Name=\"Foo Warehousing Ltd.\" OwnerSSN=\"123456789\"\u003e\n  \u003cSiteInfo address=\"No. 10, Some Ave., Some City, Some Country\"\u003e\n    \u003cSurfaceArea\u003e120000.5\u003c/SurfaceArea\u003e\n  \u003c/SiteInfo\u003e\n  \u003cAvailableItems\u003eBicycle, Football, Shoe, Treadmill\u003c/AvailableItems\u003e\n  \u003cItemInfo Item=\"Bicycle\" Count=\"10\" /\u003e\n  \u003cItemInfo Item=\"Football\" Count=\"120\" /\u003e\n  \u003cItemInfo Item=\"Shoe\" Count=\"600\" /\u003e\n  \u003cItemInfo Item=\"treadmill\" Count=\"25\" /\u003e\n  \u003cOwner\u003e\n    \u003cIdentification Name=\"John\" Family=\"Doe\" /\u003e\n    \u003cAge\u003e50\u003c/Age\u003e\n  \u003c/Owner\u003e\n\u003c/Warehouse\u003e\n```\n**And even more: You can deserialize this `XML` back to an instance of the `Warehouse` class.**\n\n## Contributors\n\n* [Sina Iravanian](https://github.com/sinairv)\n* [Julian Verdurmen](https://github.com/304NotModified)\n* [axuno gGmbH](https://github.com/axuno)\n* and many others. See [Change Log](https://github.com/YAXLib/YAXLib/blob/master/ChangeLog.md) for the list of all the people who kindly contributed to YAXLib.\n\n## Logo\n\nLogo designed by [axuno gGmbH](https://github.com/axuno)\n\n## License\n\nCopyright (c) 2009 - 2021 Sina Iravanian, Julian Verdurmen, axuno gGmbH and other contributors - Licenced under [MIT](LICENSE.txt) \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaxlib%2Fyaxlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaxlib%2Fyaxlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaxlib%2Fyaxlib/lists"}