Understanding XML Serialization in .NET Framework

XML Serialization can enable you to convert any common language runtime objects into XML documents or streams and vise versa. The XML Serialization makes it possible to convert XML documents into such a meaningful format that all programming languages can process the converted documents without any difficulty. It is also possible for you to transfer or transport the objects serialized to XML in an open standards compliant and platform agnostic manner.


The XML Serialization process in .NET Framework can make you to serialize objects into XML format that can conform to the specific XML Schema Definition (XSD) schema or even to the serialization format that has been defined in the SOAP specification. During any XML Serialization only the fields of objects that hold public properties alone are serialized. You must also be aware that during the XML Serialization it may not be possible all the time to preserve the type fidelity.

For instance, the Book object in a Library namespace cannot be deserialized into a same type of object and this indicates that there is no necessity for the target machine to have the same type of object and hence you can transfer or transport objects that has been serialized using XML Serialization in one machine to another machine even in the absence of original type in the target machine.

The XML documents that have been converted to objects by XML Serialization are strongly typed. A schema that has been written in XSD (XML Schema Definition) Language will be able to associate the information on data type with that of the attributes and elements of an XML document. The XML Serializer using the information of the data type in the schema converts the XML documents into strongly typed classes.

Further, the XML Serializer class can also be made for deserializing and serializing objects and with the help of the XML Schema Definition Tool you will be able to create classes meant for serialization. While serializing an object as XML with the XMLSerializer class, you can have full control over the process and while creating the XML Web Service, you have to apply all the attributes that control serialization to classes and members, so as to ensure that the envisaged XML output conforms to a particular schema always.

While using the XML Serializer, you can have a control over the need of a field or property to be encoded either as an attribute or an element. Further, while using the XML Serializer for specifying the name of an attribute or an element you can also additionally specify the XML namespace in the event of a field or property name becomes inappropriate.

_______________________________________________________________________

Add to My Yahoo!


FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

Visit .NET Programming Tutorial Homepage

______________________________________________________

Recommended Resource

| How to Parse an XML Document using DOM | Understanding Code Management in .NET | Understanding Enterprise Transaction Services in .NET | Understanding .NET Interface-Based Programming | Understanding Security Management in Web Services | Understanding SOAP Message and Delivery Structure | Understanding the Basics of Language Integrated Query (LINQ) | Understanding the Basics of Web Services using .NET | Understanding the Basics of XPath |


| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.