Yaxlib-XML serialization artifact

Source: Internet
Author: User

This morning, yet-another-XML-serialization-library-for-the-net was translated, and 30 pages of documents were translated in nearly four hours. BecauseArticleVery long. The re-layout pressure is too high .. I made the translation into PDF, so this article only lists the first two parts. If not. Ask the Administrator to remove it.

Download: XML serialization artifact

The entire document directory is as follows:

Directory

1 Introduction... 1

2. Why is yaxlib. 2 used?

3 yaxlib user guide... 2

3.1 basic usage and formatting... 2

3.2 serialize the object of the Collection class... 5

3.3 serialization dictionary class... 8

3.4 serialize nested objects... 13

3.5 add XML comment... 17

4 deserialization and error handling mechanisms... 18

5. Select the serialized domain... 21.

6. Define the alias of the enumerated member... 22

7. serialize multi-dimensional arrays... 24

8. serialize objects through base class or interface reference... 25

9 retain the null reference ID... 27

10 formatting data items... 28

11 multi-level deserialization... 31

12 there is no default constructor class problem... 31

13 self-reference class problems... 32

14 yaxlib features... 32

15 yaxlib exception class... 33

16. When should I use yaxlib. 34?

17 license... 34

1 Introduction

In this article, we will call the XML serialization library yaxlib .. Net also provides some serialization functions, especially xmlserializer, which isProgramIt is widely used to serialize objects into XML. Of course, deserialization is also possible. I think there are several issues with the xmlserializer class:

    1. Programmers cannot freely select the XML structure generated
    2. Serialization of some collection classes, such as the attributes of dictionary <,> or ienumerable <> is not supported.
    3. If some fields are missing during deserialization, deserialization fails, which makes it inappropriate to store the configuration file ixekeyi edited by the user.

 

2. Why is yaxlib used?

Features of yaxlib to solve the above problems

  1. A programmer can determine the structure of an XML file. An attribute can be a sub-element, an attribute of another attribute, or an element without a corresponding attribute in the class.
  2. The Collection class can also be serialized into a list of data items separated by commas (,) or any other separator. It implements some special formatting functions for the dictionary <,> object, so that the programmer can fully control the structure of the generated XML file.
  3. It supports all generic collection classes in the system. Collections. Generic namespace (likeDictionary,Hashset,Shortlist,List,Queue,Sorteddictionary,Sortedlist, AndStack) AndSystem. CollectionsNon-generic collection classes (Arraylist,Bitarray,Hashtable,Queue,Sortedlist, AndStackNon-generic collection classes can contain a variety of different objects, and the Library also supports serialization and deserialization of one-dimensional, multi-dimensional, irregular arrays.
  4. Supports serialization and deserialization of some object sets by referencing the base class/interface.
  5. Support multi-level deserialization
  6. Programmers can provide comments for the generated XML
  7. When deserialization is performed, the programmer can choose how to deal with the data that is related to the class attributes but does not appear in the XML file. In this case, you can see that the error is an error, and then the class library throws some exceptions, or records errors, or can be seen as a warning, and then assigns the corresponding attribute with the predefined value of the programmer, in addition, the program can choose to ignore this issue, and related exceptions will be neither thrown nor recorded. Please check the section on retaining null reference identifiers to see when isolated data can be ignored. This may be helpful to you.
  8. Programmers can select error handling rules by themselves. For data-sensitive applications, programmers can choose to throw and record exceptions in the case of any exceptions, for other situations (such as the storage of configuration files with less demanding requirements), programmers can choose to regard exceptions as only a warning and simply record them so that other parts of the program can continue to run.

Download: XML serialization artifact

Copyright statement: This article by http://leaver.me translation, welcome to repost share. Please respect the work of the author. Keep this note and the author's blog link when reprinting. Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.