C#¶ÔXML¶Áд
תÔØ×Ô£ºhttp://virgos.javaeye.com/blog/611146
Ò»£®Ç°ÑÔ£º
XMLÊÇ΢Èí.NetÕ½ÂÔµÄÒ»¸öÖØÒª×é³É²¿·Ö£¬¶øÇÒËü¿ÉνÊÇXML Web·þÎñµÄ»ùʯ£¬ËùÒÔÕÆÎÕ.Net¿ò¼ÜϵÄXML¼¼Êõ×ÔÈ»ÏԵ÷dz£ÖØÒªÁË¡£±¾ÎĽ«Ö¸µ¼´ó¼ÒÈçºÎÔËÓÃC#ÓïÑÔÍê³É.Net¿ò¼ÜϵÄXMLÎĵµµÄ¶Áд²Ù×÷¡£Ê×ÏÈ£¬ÎÒ»áÏò´ó¼Ò½éÉÜ.Net¿ò¼ÜÖÐÓëXMLÏà¹ØµÄÃüÃû¿Õ¼äºÍÆäÖеÄÖØÒªÀà¡£Æä´Î£¬ÎÒ»¹»á¸ø³öÓйصÄʵÀýÒÔʹ¶ÁÕ߸ü½øÒ»²½µÄÁ˽âXMLÎĵµµÄ¶Áд²Ù×÷µÄ¾ßÌå·½·¨¡£
¶þ£®XMLÃüÃû¿Õ¼äºÍÏà¹ØÀà¼ò½é£º
ÔÚÉîÈë½øÐÐ.Net¿ò¼ÜϵÄXMLÎĵµµÄ²Ù×÷֮ǰ£¬ÎÒÏëºÜÓбØÒªÏò´ó¼Ò½éÉÜ.Net¿ò¼ÜÖÐÓëXML¼¼ÊõÓйصÄÃüÃû¿Õ¼äºÍÆäÖÐһЩÖØÒªµÄÀà¡£.Net ¿ò¼ÜΪÎÒÃÇÌṩÁËÒÔÏÂһЩÃüÃû¿Õ¼ä£ºSystem.Xml¡¢System.Xml.Schema¡¢ System.Xml.Serialization¡¢System.Xml.XpathÒÔ¼° System.Xml.XslÀ´°üÈݺÍXML²Ù×÷Ïà¹ØµÄÀà¡£
System.XmlÃüÃû¿Õ¼ä°üº¬ÁËһЩ×îÖØÒªµÄXMLÀ࣬ÆäÖÐ×îÖ÷ÒªµÄÀàÊǺÍXMLÎĵµµÄ¶Áд²Ù×÷Ïà¹ØµÄÀà¡£ÕâЩÀàÖаüÀ¨4¸öÓë¶ÁÏà¹ØµÄÀàÒÔ¼° 2 ¸öÓëдÏà¹ØµÄÀà¡£ËüÃÇ·Ö±ðÊÇ£ºXmlReader¡¢XmlTextReader¡¢ XmlValidatingReader¡¢XmlNodeReader¡¢XmlWriterÒÔ¼° XmlTextWriter¡£±¾ÎĽ«Öصã½éÉÜÕâЩÀ࣬ÒòΪËüÃÇÊÇ×î»ù±¾Ò²ÊÇ×îÖØÒªµÄÀà¡£
XmlReaderÀàÊÇÒ»¸öÐé»ùÀ࣬Ëü°üº¬Á˶ÁXMLÎĵµµÄ·½·¨ºÍÊôÐÔ¡£¸ÃÀàÖеÄRead·½·¨ÊÇÒ»¸ö»ù±¾µÄ¶ÁXMLÎĵµµÄ·½·¨£¬ËüÒÔÁ÷ÐÎʽ¶ÁÈ¡ XMLÎĵµÖеĽڵ㣨Node£©¡£ÁíÍ⣬¸ÃÀ໹ÌṩÁËReadString¡¢ReadInnerXml¡¢ ReadOuterXmlºÍReadStartElementµÈ¸ü¸ß¼¶µÄ¶Á·½·¨¡£³ýÁËÌṩ¶ÁXMLÎĵµµÄ·½·¨Í⣬XmlReaderÀ໹Ϊ³ÌÐòÔ±ÌṩÁË MoveToAttribute¡¢MoveToFirstAttribute¡¢MoveToContent¡¢MoveToFirstContent¡¢ MoveToElementÒÔ¼° MoveToNextAttributeµÈ¾ßÓе¼º½¹¦Äܵķ½·¨¡£ÔÚ±¾ÎĺóÃæ½éÉܵÄʵÀýÖУ¬ÎÒÃǽ«ÔËÓõ½ÕâЩ·½·¨¡£
XmlTextReader¡¢XmlNodeReaderÒÔ¼°XmlValidatingReaderµÈÀàÊÇ´ÓXmlReaderÀà¼Ì³Ð¹ýÀ´µÄ×ÓÀà¡£¸ù¾ÝËüÃǵÄÃû³Æ£¬ÎÒÃÇ¿ÉÒÔÖªµÀÆä×÷Ó÷ֱðÊǶÁÈ¡Îı¾ÄÚÈÝ¡¢¶ÁÈ¡½ÚµãºÍ¶ÁÈ¡XMLģʽ£¨Schemas£©¡£
XmlWriterÀàΪ³ÌÐòÔ±ÌṩÁËÐí¶àдXMLÎĵµµÄ·½·¨£¬ËüÊÇXmlTextWriterÀàµÄ»ùÀ࣬ÎÒÔÚºóÃæµÄʵÀýÖлá¸ø³öÏà¹ØµÄÔËÓ÷½·¨¡£
XmlNodeÀàÊÇÒ»¸ö·Ç³£ÖØÒªµÄÀ࣬Ëü´ú±íÁËXMLÎĵµÖеÄij¸ö½Úµã¡£¸Ã½Úµã¿ÉÒÔÊÇXMLÎĵµµÄ¸ù½Úµã£¬ÕâÑùËü¾Í´ú±íÕû¸öXMLÎĵµÁË¡£ËüÊÇÐí¶àºÜÓÐÓõÄÀàµÄ»ùÀ࣬ÕâЩÀà°üÀ¨²åÈë½ÚµãµÄÀࡢɾ³ý½ÚµãµÄÀà¡¢Ìæ»»½ÚµãµÄÀàÒÔ¼°ÔÚXMLÎĵµÖÐÍê³Éµ¼º½¹¦ÄܵÄÀࡣͬʱ£¬XmlNodeÀ໹Ϊ³ÌÐòÔ
Ïà¹ØÎĵµ£º
·½·¨Ò»£º
²ÉȡͨÓõÄbase64±àÂ뷽ʽ£¬È¡Ê±½âÂë´æʱ¼ÓÂë¡£
ëÀÏʦÌṩÁËÍêÕûµÄ±àÂë´úÂ룬ÇÒЧÂʺܸߡ£
unit Base64;
interface
uses SysUtils, Classes;
type
{$IFDEF UNICODE}
Base64String = AnsiString;
{$ELSE}
Base64String = strin ......
/*
Êý¾Ý¿â²éѯXML½á¹¹£¬FOR XML PATH Óï¾äµÄÓ¦ÓÃ
*/
FOR XML PATH Óï¾äµÄÓ¦ÓÃ:
CREATE TABLE TempTable(UserID int , UserName nvarchar(50));
insert into TempTable (UserID,UserName) values (1,'a')
insert into TempTable (UserID,UserName) values (2,'b')
select UserID,UserName from TempTable FOR ......
DataGridView ¿Ø¼þDataGridView ¿Ø¼þÌṩÓÃÀ´ÏÔʾÊý¾ÝµÄ¿É×Ô¶¨Òå±í¡£Ê¹Óà DataGridView À࣬¿ÉÒÔ×Ô¶¨Òåµ¥Ôª¸ñ¡¢ÐС¢Áкͱ߿ò¡£
×¢Òâ
DataGridView ¿Ø¼þÌṩ DataGrid ¿Ø¼þËù²»¾ß±¸µÄÐí¶à»ù±¾ºÍ¸ß¼¶¹¦ÄÜ¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼û Windows ´°Ìå DataGridView ¿Ø¼þºÍ
DataGrid ¿Ø¼þÖ®¼äµÄÇø±ð
³£ÓÃÊôÐÔ:
DefaultCellStyle¡¢ ......
×Ý×ø±êºº×Ö˵Ã÷ yAxisName='̨' rotateYAxisName='0'
FusionCharts µÄ XML±êÇ©ÊôÐÔÓÐÒ»ÏÂËÄÖÖÊý¾ÝÀàÐÍ
* Boolean - ²¼¶ûÀàÐÍ£¬Ö»ÄÜΪ1»òÕß0¡£ÀýÈ磺<graph showNames=’1′ >
* Number - Êý×ÖÀàÐÍ£¬Ö»ÄÜΪÊý×Ö¡£ÀýÈ磺<graph yAxisMaxValue=’200′ >
* String - ×Ö·û´®ÀàÐÍ£¬Ö ......