¼±ÎÊ linq to xml È¥ÖØ - .NET¼¼Êõ / LINQ
´ó¼ÒºÃ£º
ÎÒ¸Õ¸Õ½Ó´¥linq£¬¿´×ÅÊéÉÏдÁ˸öÀý×Ó¡£µ«ÊÇÎÒÏë°ÑÐÅÏ¢Öظ´µÄÈ¥µôÈ»ºóÏÔʾµ½±í¸ñÖУ¬µ«ÊÇÎÒ²»ÖªµÀÈçºÎÈ¥ÖØ¡£
XML code:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<Employee>
<Name>eigt</Name>
<Email>Eigt@163.com</Email>
</Employee>
<Employee>
<Name>eigt</Name>
<Email>Eigt@163.com</Email>
</Employee>
<Employee>
<Name>eigt</Name>
<Email>Eigt@163.com</Email>
</Employee>
<Employee>
<Name>eigt</Name>
<Email>Eigt@163.com</Email>
</Employee>
<Employee>
<Name>eigt</Name>
<Email>Eigt@163.com</Email>
</Employee>
<Employee>
<Name>eigt</Name>
<Email>Eigt@163.com</Email>
</Employee>
<Employee>
<Name>jenny</Name>
<Email>Jenny@163.com</Email>
</Employee>
</Root>
Õâ¸öxmlÏÔʾµÄÊǸöÈË»ù±¾ÐÅÏ¢ÀïÃ滹ÓкܶàÈ˵ÄÐÅÏ¢£¬Ö»ÄÃÁ½¸öÈËÀ´¾ÙÀý£¬ÆäÖÐÒ»¸öÈ˵ÄÐÅÏ¢Öظ´£¬ÎÒÏëÈÃÖظ´µÄÐÅÏ¢Ö»ÏÔʾһÌõÐÅÏ¢
C# code:
StringBuilder user=new StringBuilder();
Ïà¹ØÎÊ´ð£º
txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔÊý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' ´ò¿ª¸Õ´´½¨µÄÎļþ¡£
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' ¶ÁÈëËùÓÐ×Ö·ûµ½±äÁ¿ÖÐ ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎĶ¼¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......
˼·£ºÒªÓÃc#Éú³ÉÒ»¸ö²¥·Å»úµÄ²¥·ÅÁбíµÄxml£¬ÀýÈ磺
<daty datys='2010-04-05' datye='2010-05-01' > //ÕâÊDz¥·ÅµÄÈÕÆÚ¶Î
<time times='01:12:00' timee='02:30:00'> ......
<?xml version="1.0" encoding="utf-8" ?>
<HuiSin>
<admin>100,100</admin>
<user>200,200</user>
ÔõÑùÔÚÕâÀïÌí¼ÓÒ»¸öеÄÄØ£¿
< ......