linq的出现,带给我们的是简结,快速,可读性,它由linq to sql,linq to object,linq to XML组成,我的博客之前有对linq to sql的讲解,而今天,我将讲一个linq to xml架构,将对于操作XML文件进行读写操作,它会让你像使用linq to sql一样,操作你的xml文件,OK,我们来看一下,下面的一个XML文件。
<?xml version="1.0"?>
<ArrayOfDataSync xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<DataSync>
<__isset>
<IsSync>true</IsSync>
<FilePath>true</FilePath>
<CurrentSeek>true</CurrentSeek>
<ClientKey>true</ClientKey>
<OrderNumber>true</OrderNumber>
<OccurTime>true</OccurTime>
<Name>false</Name>
<Size>false</Size>
<LastDate>false</LastDate>
</__isset>
<IsSync>true</IsSync>
<FilePath>d:\path\资料\thrift文件\thrift文件\testJava.thrift</FilePath>
<CurrentSeek>1297</CurrentSeek>
<ClientKey>8C:89:A5:E1:89:3D</ClientKey>
<OrderNumber>1</OrderNumber>
<OccurTime>2014/1/26 15:32:46</OccurTime>
<Size>0</Size>
</DataSync>
<DataSync>
<__isset>
<IsSync>true</IsSync>
<FilePath>true</FilePath>
<CurrentSeek>true</CurrentSeek>
<ClientKey>true</ClientKey>
<OrderNumber>true</OrderNumber>
<OccurTime>true</OccurTime>
<Name>false</Name>
<Size>false</Size>
<LastDate>false</LastDate>
</__isset>
<IsSync>true</IsSync>
<FilePath>d:\path\资料\thrift文件\thrift文件\thrift-0.8.0.exe</FilePath>
<CurrentSeek>4013056</CurrentSeek>
<ClientKey>8C:89:A5:E1:89:3D</ClientKey>
<OrderNumber>1</OrderNumber>
<OccurTime>2014/1/26 15:32:46</OccurTime>
<Size>0</Size>
</DataSync>
<DataSync>
<__isset>
<IsSync>true</IsSync>
<FilePath>true</FilePath>
<CurrentSeek>true</CurrentSeek>
<ClientKey>true</ClientKey>
<OrderNumber>true</OrderNumber>
<OccurTime>true</OccurTime>
<Name>false</Name>
<Size>false</Size>
<LastDate>false</LastDate>
</__isset>
<IsSync>true</IsSync>
<FilePath>d:\path\资料\thrift文件\thrift文件\thrift_白皮书.pdf</FilePath>
<CurrentSeek>441217</CurrentSeek>
<ClientKey>8C:89:A5:E1:89:3D</ClientKey>
<OrderNumber>1</OrderNumber>
<OccurTime>2014/1/26 15:32:46</OccurTime>
<Size>0</Size>
</DataSync>
<DataSync>
<__isset>
<IsSync>true</IsSync>
<FilePath>true</FilePath>
<CurrentSeek>true</CurrentSeek>
<ClientKey>true</ClientKey>
<OrderNumber>true</OrderNumber>
<OccurTime>true</OccurTime>
<Name>false</Name>
<Size>false</Size>
<LastDate>false</LastDate>
</__isset>
<IsSync>true</IsSync>
<FilePath>d:\path\资料\thrift文件\thrift文件\thrift命令.txt</FilePath>
<CurrentSeek>131</CurrentSeek>
<ClientKey>8C:89:A5:E1:89:3D</ClientKey>
<OrderNumber>1</OrderNumber>
<OccurTime>2014/1/26 15:32:46</OccurTime>
<Size>0</Size>
</DataSync>
</ArrayOfDataSync>
这个文件是thrift自动为我们生成的,现在我们使用linq to xml来读这个文件里的内容读出来,当然你也可以使用XML反序列化的方式,将它反序列化成对象,再读出。
System.Console.WriteLine("Loading XML data...");
var data =
(from e in XElement.Load("D:\\path\\资料\\thrift文件\\thrift文件\\fileUploadLog.xml_log.xml")
.Elements("DataSync")
select new DataSync
{
OrderNumber = Convert.ToInt32(e.Element("OrderNumber").Value),
IsSync = Convert.ToBoolean(e.Element("IsSync").Value),
FilePath = e.Element("FilePath").Value,
CurrentSeek = Convert.ToInt64(e.Element("CurrentSeek").Value),
ClientKey = e.Element("ClientKey").Value,
OccurTime = e.Element("OccurTime").Value,
}).ToList();
data.ForEach(i => System.Console.WriteLine(i.ToString()));
而输出的结果如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoQAAACSCAIAAABTxUy3AAAfNElEQVR4nO2dQXLlvA2EdbQcLUfTMssscqAsUnmlIdDNBkhJz57+VnoQ2GiAtPlPynaO//z7X//85z//8Y9/HMYYY4x5nP/8+1+HL2N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ClXRjaUKSgvP+BwmpqxCOUih1xd6fng+SuO/CfVfxp/n6yj5zsVnrhP3daqpp5X89NCXcw+kEfE5aqavSsYUn23Euqji1I8e5K9SJ3HCHOS/p6P4VJzEZ93PmaHUOm8+V8QqeXv9mL7a5RPNQVmiJBCfSGfamqJzxz7edB6+itplfGpfPGdg0EQ6wxKufxQvY91PD3156oEoKHG9L+KTGIs+03k2iAqD8tR/9KP0ux4n8yfwzOo8uStlbZxbta9hYVyeBo+bz5ViuBff5ZOMXXTO50w0lXh8FvXv2MddOt9M+V/GV/jOpfVEnfOGy1j3E50o6MlozkhBiZO9030SY4rP66reKFIFvbVSMindSF5smbzl86z2q+hU+4r5Z+vrV5mMOGTRJ0kopfV8Dpm9UaMgN4xqVfVvnY8o+GtQf5p6OnTlWdFBHtApEdNKfq6v9EOAklMdvcfGs9KX8grNmdRF/U7L6b1wce4NZfL8xvwJvK4yz54fvi8rOujjVHNIW/GPOlLmNm3k81HR0X0qY0zFh+fpnEktJV7V2TUfpPBbkX7P+LwwrL/G4x6IOmiDkf70QIilSV8lzkD6Fq1CUqX4kbVPihL9KHjN4TolyNzSOMlPXSFvSKeaHytu6Xeqg/Kn89HViAiqm368JscHkq+bnzaVBkl88Jku2eUT6af+o584t0Oe51QfJaNVqK/KPEbWFX4Q/gtc9/JXHSbz6/kp5/mn+ET8dP+mgS9jY4wx5mV8GRtjjDEv48vYGGOMeRlfxsYYY8zL+DI2xhhjXsaXsTHGGPMy//n3v/4Ldw+cjx2DEX0AAAAASUVORK5CYII=" alt="" />
上面的例子中,我们的XML文件使用的是元素的方式,也可以使用属性的形式,代码只要稍作修改即可。