xmlµÄÐòÁл¯ºÍ·´ÐòÁл¯
XMLÐòÁл¯Óë·´ÐòÁл¯ ÕûÀíÎĵµ
XMLÐòÁл¯Óë·´ÐòÁл¯
// OBJECT -> XML
public static void SaveXml(string filePath, object obj) { SaveXml(filePath, obj, obj.GetType()); }
public static void SaveXml(string filePath, object obj, System.Type type)
{
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(filePath))
{
System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(type);
xs.Serialize(writer, obj);
writer.Close();
}
}
// XML -> OBJECT
public static object LoadXml(string filePath, System.Type type)
{
if (!System.IO.File.Exists(filePath))
return null;
using (System.IO.StreamReader reader = new System.IO.StreamReader(filePath))
{
System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(type);
object obj = xs.Deserialize(reader);
reader.Close();
return obj;
}
}
Ïà¹ØµÄ³£ÓÃAttribute£¨ÃüÃû¿Õ¼äSystem.Xml.Serialization £©
[XmlRootAttribute("PurchaseOrder", Namespace=
Ïà¹ØÎĵµ£º
ת×Ô£ºhttp://www.cnblogs.com/sadier/articles/99875.html
ÎÄÕÂÕýÎÄ
Ç°¶Îʱ¼ä£¬ÓÉÓÚ¹¤×÷µÄÐèÒª£¬ÀûÓõ½ÁËXML£¬ËùÒÔ¶ÔÆä½øÐÐÁËһЩ¼òµ¥µÄÑо¿¡£ÔÚ´ËÔ¸°ÑһЩÐĵÃд³öÀ´£¬Óë¸÷λ·ÖÏí£¬²»¶ÔµÄµØ·½»¹Íû¶à¶à°üº¡£
1.ʲôÊÇ XML?
Ê×ÏÈ£¬ÎÒÏë¸÷λӦ¸Ã¶¼ÒѾ´ó¸ÅÖªµÀʲôÊÇXMLÁË¡£Èç¹û£¬Äã¶Ôʲà ......
<?xml version="1.0" standalone="yes"?>
<imgs>
<pic name="/adv_pic/1.jpg" url="http://www.baidu.com/" title="test" />
<pic name="/adv_pic/2.jpg" url="http://www.baidu.com/" title="test" />
......
public partial class Form1 : Form
{
DataSet ds = new DataSet();
public Form1()
{
......
FusionCharts µÄ XML±êÇ©ÊôÐÔÓÐÒ»ÏÂËÄÖÖÊý¾ÝÀàÐÍ
* Boolean - ²¼¶ûÀàÐÍ£¬Ö»ÄÜΪ1»òÕß0¡£ÀýÈ磺<graph showNames=’1′ >
* Number - Êý×ÖÀàÐÍ£¬Ö»ÄÜΪÊý×Ö¡£ÀýÈ磺<graph yAxisMaxValue=’200′ >
* String - ×Ö·û´®ÀàÐÍ£¬Ö»ÄÜΪ×Ö·û´®¡£ÀýÈ磺 <graph caption=’My Chart&rsqu ......