04.05.2009, 14:05 | #1 |
Участник
|
PatrickChua: XML serialization
Источник: http://patrickchuaax.spaces.live.com...68AA!117.entry
============== Today I learned about XML serialization. What is XML serialization ? Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an object and transport it over the Internet using HTTP between a client and a server. On the other end, deserialization reconstructs the object from the stream. what is being serialize ? Only public fields and property value can be serialized. Kaya ba i-serialize ang mga method,indexers, fields na private ? Hindi. Ano ang main class or central class ng XML serialization ? XMLserializer. Ano naman ang mga methods nito ? Ang pinakaimportanteng method ay dalawa lamang: Serialize at Deserialize. ano naman ang output ng serialization ? XML stream ang tawag sa generated output. Ito ay compliant o ayun sa www.w3.org consortium XML schema definition language (XSD) 1.0 recommendation. Ang data type naman na generated ay ayun din naman sa XML schema part2 DataTypes na documento. Ibig sabihin, dahil complient siya maaring ito mabasa ng mga browser or anumng uri ng data transport utility sa internet. Ano ang pang parse sa XML stream? XmlSerializer can be use to parse XML stream when it is expected to conform to a known XML Schema. Pwede rin gamitin natin ang XMLserializer. Kung hindi ka naman segurado ng comporme sa XML schema ang XML stream, pwede mo gamitin ang XMLreader at XMLwriter classes. ang XMLreader is isa sa mga classes na nasa .net framework. Ito ay maaring gamitin para bumasa ng xml stream. ang XMLwriter naman ay para makasulat or maka generate ng XML stream. Bukod sa XML stream, mayroon pa ba ibang generated format ang XMLSerializer ? Mayroon.Ito ang SOAP XML stream. Saan naman pwede gamitin ang mga generated SOAP xml stream ? Pwede ito ipasa sa mga web services. Serialization of a Simple Class The following example shows a simple class with a public field. [Visual Basic] Public Class OrderForm Public OrderDate As DateTime End Class [C#] public class OrderForm{ public DateTime OrderDate; } When an instance of this class is serialized, it might resemble the following. 12/12/01 Ano ang pwede i-serialized? Items That Can Be Serialized The following items can be serialized using the XmLSerializer class.
Paano bang mag-serialize ? To serialize an object
============== Источник: http://patrickchuaax.spaces.live.com...68AA!117.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|