AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.05.2009, 14:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
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.
  • Public read/write properties and fields of public classes.
  • Classes that implement ICollection or IEnumerable. (Note that only collections are serialized, not public properties.)
  • XmlElement objects.
  • XmlNode objects.
  • DataSet objects.
 

 

 Paano bang mag-serialize ?

 

 


To serialize an object
  1. Create the object and set its public fields and properties.
  2. Construct an XmlSerializer using the type of the object. For more information, see the XmlSerializer class constructors.
  3. Call the Serialize method to generate either an XML stream or a file representation of the object's public properties and fields. The following example creates a file. [Visual Basic] Dim myObject As MySerializableClass = New MySerializableClass() ' Insert code to set properties and fields of the object. Dim mySerializer As XmlSerializer = New XmlSerializer(GetType(MySerializableClass)) ' To write to a file, create a StreamWriter object. Dim myWriter As StreamWriter = New StreamWriter("myFileName.xml") mySerializer.Serialize(myWriter, myObject) [C#] MySerializableClass myObject = new MySerializableClass(); // Insert code to set properties and fields of the object. XmlSerializer mySerializer = new XmlSerializer(typeof(MySerializableClass)); // To write to a file, create a StreamWriter object. StreamWriter myWriter = new StreamWriter("myFileName.xml"); mySerializer.Serialize(myWriter, myObject);
 

 

 

 


 
 
 
 
 
 
 
 
 
 
 


==============
Источник: http://patrickchuaax.spaces.live.com...68AA!117.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
dax-lessons: Generate XML Documentation Files for a project - DAX 2009 Blog bot DAX Blogs 0 08.08.2008 19:06
axStart: How to use XSLT in AIF and what’s wrong with empty xml Nodes. Blog bot DAX Blogs 0 27.04.2008 18:07
Inside Dynamics AX 4.0: The XML Structure Blog bot DAX Blogs 0 04.10.2007 11:20
Inside Dynamics AX 4.0: XML Document Integration Blog bot DAX Blogs 0 04.10.2007 11:20
casperkamal: Data XML Generation Wizard - Version 2.0 For Dynamics Ax Blog bot DAX Blogs 0 04.03.2007 23:04
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 10:47.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.