Summary
XML Serialization is the premiere way to manipulate XML with the .NET Framework. You can use it instead of a DOM or stream-based XML parser to manipulate objects and their properties easily. This chapter covered the following key points with regard to XML Serialization of classes:
Classes must have a default constructor.
Only public fields and properties of the class will be serialized.
By default, these properties will be serialized as child elements. This can be changed with the [XmlAttribute] attribute.
Other attributes manipulate other XML properties, such as element or attribute name, namespace, and data type.
Encoded XML (as defined by SOAP 1.1, Section 5) can be serialized using the Soap attributes from System.Xml.Serialization.
XML Serialization works with Web services and provides Web service developers with complete control over the format of the XML their service expects and returns.
|