Select the product you need help with
INFO: Roadmap for XML Serialization in the .NET FrameworkArticle ID: 314150 This article was previously published under Q314150 On This PageSummary This article provides a roadmap to learn and to master
serialization and deserialization of XML with the .NET Framework (System.Xml namespace). Roadmap articles provide links to useful information, including online documentation, Microsoft Knowledge Base articles, and Microsoft white papers, to help you learn about a Microsoft product or technology. Microsoft Knowledge Base How To articles and walkthroughs provide step-by-step instructions to complete specific tasks. QuickStart sample files are ready-made programs that illustrate a technique. OverviewSerialization is the process of converting an object into a form that can be easily transported. For example, you can serialize an object and transport it over the Internet by using HTTP between a client and a server. On the other end, deserialization reconstructs the object from the stream.The .NET Framework features two serializing technologies:
The following links provide overview information about XML serialization and deserialization in Microsoft Visual Studio .NET:
Introducing XML Serialization http://msdn2.microsoft.com/en-us/library/182eeyhh(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/182eeyhh(vs.71).aspx)
XML and SOAP Serialization http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconserialization.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconserialization.asp)
XML Serialization ArchitectureThe System.Xml.Serialization namespace contains the classes that are used to serialize objects into XML format documents or streams.The central class in the namespace is the XmlSerializer class. To use this class, use the constructor of the XmlSerializer to create an instance of the class by using the Type of the object to serialize. After an XmlSerializer is created, create an instance of the object to serialize. You must also create an object to write the file to a document or stream, such as a Stream, a TextWriter, or an XmlWriter. You can then call the Serialize method to convert the object to an XML document. To deserialize an object from an XML document, create a suitable object to read the document or stream (again a Stream, a TextWriter, or an XmlWriter). Invoke the Deserialize method while casting the resulting object to the Type of the original object that was serialized. To control the serialization more, the System.Xml.Serialization namespace provides several Attribute classes that can be applied to members of a class. For example, if a class contains a member that will be serialized as an XML element, you can apply the XmlElementAttribute attribute to the member. When applying the attribute, you can specify details such as the actual XML element name by using the ElementName property. The following link provides architectural (internal) information about XML serialization and deserialization:
XML Serialization Class http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlserializer(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlserializer(vs.71).aspx)
System.Xml.Serialization Hierarchy http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlserializationhierarchy.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlserializationhierarchy.asp)
Key Concepts and QuickstartsThe following links take you to documentation about key XML serialization and deserialization concepts and Quickstart tutorials.
XML Serialization with XML Web Services The "Examples of XML Serialization" link gives several code
samples that demonstrate XML serialization, including the following:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmlserializationwithwebservices.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmlserializationwithwebservices.asp)
Overriding XML Serialization http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconoverridingserializationofclasseswithxmlattributeoverridesclass.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconoverridingserializationofclasseswithxmlattributeoverridesclass.asp)
.NET Samples - How To: XML Serialization http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpqstart/html/cpsmpnetsamples-howtoxmlserialization.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpqstart/html/cpsmpnetsamples-howtoxmlserialization.asp)
Examples of XML Serialization The "Controlling XML Serialization Using Attributes" link
discusses the following topics with code samples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconanexampleofxmlserializationwithxmlserializer.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconanexampleofxmlserializationwithxmlserializer.asp)
Controlling XML Serialization Using Attributes http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcontrollingserializationbyxmlserializerwithattributes.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcontrollingserializationbyxmlserializerwithattributes.asp)
Knowledge Base ArticlesMicrosoft Knowledge Base How To articles provide step-by-step instructions to complete a specific task.315703
(http://support.microsoft.com/kb/315703/EN-US/
)
HOW TO: Serialize an Object to XML by Using Visual Basic .NET
316730 You can also run XSL transformations (XSLT), query
and modify XML data by using DOM, and serialize or deserialize XML data by
using the System.Xml classes in the .NET Framework. For more information, see the
following Knowledge Base article:
(http://support.microsoft.com/kb/316730/EN-US/
)
HOW TO: Serialize and Deserialize XML in Visual Basic .NET
313651
(http://support.microsoft.com/kb/313651/EN-US/
)
Roadmap for XML in the .NET Framework
WalkthroughsWalkthroughs provide mini-tutorials that walk you through some typical application development scenarios that use XML serialization and deserialization. The following link will take you to walkthrough documents.
Using Schema and Serialization to Leverage Business Logic http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml04162001.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml04162001.asp)
TroubleshootingIf you experience problems and want assistance, the best place to start is at the Microsoft Product Support Services (PSS) Web site:http://support.microsoft.com You have several options to find answers to your questions. You
can search the Microsoft Knowledge Base, post your questions or share your
experiences on Microsoft newsgroups, obtain the latest service packs and news
about a specific product, or contact Microsoft Product
Support.
(http://support.microsoft.com)
PropertiesArticle ID: 314150 - Last Review: December 12, 2012 - Revision: 4.0
|



Back to the top








