Main BLOGGER
Google
WWW THIS BLOG
Friday, February 11, 2005
 
Overview of XML Processing in .NET XML Web Services
- The central class is the XmlSerializer class, and its most importantmethods are the Serialize() and Deserialize() methods.

- All the XmlSerializer constructors expect to receive someinformation about the types of objects they are going to serialize or de-serialize. Most of them require passing in a type object directly.

- Once an instance of XmlSerializer class is created, it will generateand compile code on the fly to do serialization and de-serialization. The generated code is able to statically bind XML stream to target types.

- The on-the-fly code generation and compilation are computingintense. This leads to the "first invocation is slow" issue. But there will be no reflection overhead at serialize-/de-serialize-time.

- The generated de-serialization code in Deserialize() method is astream based pull parser. This parser checks the XML stream for content to instantiate the target type. If no matching type mapping is found it will throw an exception. In the parsing process, the XmlReader class provides forward-only, read-only access to a stream of XML data.

- In .NET, types can be annotated by attributes. The attributes arestored as the metadata in the Assembly. Attributes are used to control the XML stream generated by the XmlSerializer class, allowing you to set the XML namespace, element name, attribute name, and so on, of the XML stream.

- Given an XML Schema, you can run the XML Schema Definition tool toproduce a set of classes that are strongly typed to the schema and annotated with attributes.

References

1. A Comparison of XML Processing in .NET and J2EE http://www.idealliance.org/papers/dx_xml03/papers/06-01-03/06-01-03.html#s4.2

2. Introducing to XML Serialization in .NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconintroducingxmlserialization.asp

3. The XmlSerializer reference
http://www.topxml.com/xmlserializer/xmlserializer.asp



<< Home

Powered by Blogger

Google
WWW THIS BLOG