XmlÐòÁл¯ºÍ·´ÐòÁл¯
¾³£¼ûXMLÐòÁл¯µÄÎÄÕ£¬¶Ô¸ÃÐòÁл¯·½Ê½²¢²»ÊÇÌ«ÏþµÃ£¬¿´ÁËMSDNºÍһЩ×ÊÁϺóÓÐÁË´óÖµÄÁ˽⣬´óµÀÀí½²²»³öÀ´£¬ÉÏ ´úÂëÏÈ£º
·½Ê½Ò» ͨ¹ýXmlSerializeÖ±½ÓÐòÁл¯£º
Class BeSerialized
{
//ij×Ö¶Î
public int someFiled;
//¹«¹²ÀàµÄÒ»¸ö¿ÉÐòÁл¯µÄÊôÐÔ
private bool serialme;
public bool SerialMe
{
get { return serialme; }
set { serialme = value; }
}
}
class process
{
public void Main()
{
SerialIt();
DeSerialIt();
}
SerialIt()
{
BeSerialized bs=new BeSerialized();
bs.someFiled=;
bs.SerialMe=;
XmlSerialize xs=new XmlSerialize(typeof(BeSerialized));
StreamWriter sw=
xs.Serialze(sw,bs);
}
DeSerialIt()
{
XmlSerialze xs=new XmlSerialize(typeof(BeSerialized));
StreamReader sr
BeSerialized bs=(BeSerialized)xs.DeSerialize(sr);
}
}
·½Ê½¶þ ÊÖ¶¯ÔÚÒªÐòÁл¯µÄÀàÉèÖÃÊôÐÔÀàÐÍ
public class Student
{
private int id;
[xmlAttribute]
public int ID //ÐòÁл¯Ê±×÷ΪStudent½ÚµãµÄÊôÐÔ¶ø²»ÊÇĬÈϵÄ×Ó½Úµã
{
get { return id; }
set { id = value; }
}
private string name;
[XmlElement("sname")]
public string Name //½ÚµãÃû³ÆΪsname¶ø²»ÊÇĬÈϵÄName
{
get { return name; }
set { name = value; }
}
private int age;
[XmlIgnore]
public int Age //ºöÂÔ¸ÃÊôÐÔ£¬²»´æÈëXMLÎļþ
{
get { return age; }
set { age = value; }
}
internal int score = 88;
public override string ToString()
{
Ïà¹ØÎĵµ£º
¶ÔÓÚ.NETµ½µ×ÊÇʲôÕâ¸öÎÊÌ⣬ÓÐן÷ÖÖ¸÷ÑùµÄ˵·¨¡£µ«µ±Ê±×÷ΪÊ×ϯִÐйٵı«¶ûĬӦ¸Ã×îÄÜ´ú±í΢Èí¹«Ë¾µÄ¹Û
µã£¬Ëû˵£º“Microsoft.NET ´ú±íÁËÒ»¸ö¼¯ºÏ¡¢Ò»¸ö»·¾³¡¢Ò»¸ö¿ÉÒÔ×÷Ϊƽ̨֧³ÖÏÂÒ»´úInternetµÄ¿É±à³Ì½á¹¹¡£”È·
ʵ£¬Õâ¾ä»°»ù±¾Éϼòµ¥¶óÒªµØ±íÊöÁË.NETµÄÍâÌØÐÔ¡£
.NETÊ×ÏÈÊÇÒ»¸ö»·¾³¡ ......
¼òµ¥µÄÀ࣬¼ò»¯×Ô¼º¶ÁÈ¡xmlµÄ¹ý³Ì
ReadXML.as
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.system.System;
import flash.events.EventDis ......
д±¾ÎĵÄÄ¿µÄÊÇΪÁË·½±ã´ó¼ÒÁ˽âC++ MSXML²Ù×÷·½·¨¡£
µ±È»£¬C++ÖжÔMSXMLµÄµ÷ÓÃÓжàÖÖ£¬±¾ÎIJÉÓõķ½·¨ÊÇÍêÈ«²ÎÕÕMSXML SDKÌṩµÄÎĵµ½øÐвÙ×÷¡£
Èç¹ûÓÐʲô´íÎ󣬻¶ÓÖ¸Õý¡£
´úÂë¿ò¼ÜÊÇ»ùÓÚvs2008 MFC ¶Ô»°¿ò³ÌÐò£¨UNICODE£©¡£¶Ô»°¿ò³ÌÐòÐèÒª¶ÁÕß×Ô¼º´´½¨¡£
#include <msxml6.h>
#include <comutil.h>
# ......
http://www.cnblogs.com/long2006sky/articles/1258731.html
DataSetת»»ÎªxmlÎļþ
//½«DataSetת»»ÎªxmlÎļþ
private static void ConvertDataSetToXMLFile(DataSet xmlDS, string xmlFile)
{
&n ......
using System;
using System.Xml;
namespace ReadXMLfromFile
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
static void Main(string[] args)
{
XmlTextReader reader = new XmlTextReader ("books.xml");
......