XMLTextReader和XmlDocument读取XML文件的比较

看到网上一片文章,自己式了一下,果然
<wbr>XMLTextReader速度要快!<br><br> 在.NET框架的System.XML名称空间中包含的XMLTextReader类不需要对系统资源要求很高,就能从XML文件中快速读取数据。使用XMLTextReader类能够从XML文件中读取数据,并且将其转换为HTML格式在浏览器中输出。 <p><wbr></wbr></p> <p>  读本文之前,读者需要了解一些基本知识:XML、HTML、C#编程语言,以及.NET尤其是ASP.NET框架的一些知识。</p> <p>  微软公司的.NET框架为开发者提供了许多开发的便利,随着XML的重要性不断增长,开发者们都期待着有一整套功能强大的XML工具被开发出来。.NET框架没有辜负我们的这番期望,在System.XML<wbr>名称空间中组织进了以下几个用于XML的类:</wbr></p> <p>  XMLTextReader------提供以快速、单向、无缓冲的方式存取XML数据。(单向意味着你只能从前往后读取XML文件,而不能逆向读取)</p> <p>  XMLValidatingReader------与XMLTextReader类一起使用,提供验证DTD、XDR和XSD架构的能力。</p> <p>  XMLDocument------遵循W3C文档对象模型规范的一级和二级标准,实现XML数据随机的、有缓存的存取。一级水平包含了DOM的最基本的部分,而二级水平增加多种改进,包括增加了对名称空间和级连状图表(css)的支持。</p> <p>  XMLTextWriter------生成遵循<wbr>W3C<wbr>XML<wbr>1.0<wbr>规范的XML文件。</wbr></wbr></wbr></wbr></p> <p>  本文主要讲述的是第一个类XMLTextReader,这个类设计的目的就是从XML文件中快速的读取数据,而对系统资源(主要包括内存和处理器时间)不做很高的要求。在父级程序的控制下,它通过每次只处理一个节点的方式对XML文件进行逐步操作,实现这种工作过程。在XML文件的每个节点中,父级程序能决定该节点的类型,它的属性和数据(如果有的话),以及其他有关该节点的信息。基于这些信息,父级程序可以选择是处理这个节点还是忽略该节点的信息,以满足各种应用程序请求的需要。这被称为抽取式(pull)处理模型,因为父级程序发出请求并且从XML文件中抽取各个节点,然后根据需要处理它或者是不处理它。<br>   我们可以把XMLTextReader类和XML简单应用程序接口,即SAX相比,后者是在编程人员中非常流行的另一种读取XML数据的技术。XMLTextReader<wbr>和SAX有一点很相似,它们都不需要占用很多的系统资源,就能迅速的从XML文件读取数据。但是,与XMLTextReader的抽取式模型迥然不同,SAX使用的是推入式模型:XML处理器通过<wbr>“事件”告知主机应用程序哪些节点数据是可以获得,那些不能获得;根据需要,主机程序则作出相应的反应或置之不理。换句话说,数据的传送方向是从SAX处理程序中推入到主机。程序员们势必会在抽取式和推入式处理模型谁更有优势的问题上争论一番,但是大家都不可否认的是,两种模型都能很好的进行工作。.NET<wbr>框架不支持SAX,但是你能使用现存的SAX工具,<wbr>例如<wbr>MSXML分析器,用于你的.NET<wbr>程序。</wbr></wbr></wbr></wbr></wbr></wbr></p> <p>  XMLTextReader<wbr>类有一些构造程序来适应各种各样的情况,比如从一个已经存在的数据流或统一资源定位网址读取数据。最常见的是,你或许想从一个文件读取XML数据,那么也就有一个相应的构造程序来为此服务。这里有一个例子(我的所有代码例子都使用的是C#语言,如果你喜欢使用VISUAL<wbr>BASIC语言,它们转换起来很容易)。</wbr></wbr></p> <p>XMLTextReader<wbr>myReader;<br> myReader<wbr>=<wbr>New<wbr>XMLTextReader("c:\data\sales.XML")<wbr></wbr></wbr></wbr></wbr></wbr></p> <p>  创建一个称为Read()方法的循环,这个方法的返回值总是为真,直到到达文件的底部时,返回值才变为假。换句话说,<wbr>循环在文件的开始时启动并且读入所有的节点,<wbr>一次读入一个节点,<wbr>直到到达文件的结尾:</wbr></wbr></wbr></p> <p>While<wbr>(myReader.Read())<wbr>{<br> ...<br> //<wbr>在这里处理每个节点.<br> ...<br> }<wbr></wbr></wbr></wbr></wbr></p> <p>  每次成功调用Read()之后,XMLTextReader实例化程序包含了目前节点(即刚刚从文件中读取的那个节点)的信息。我们可以从XMLTextReader的成员中获得上述信息,就像表格1中描述的一样;并通过NodeType属性判断出当前节点的类型。在节点类型的基础上,程序的代码可以读取节点数据,检查它是否有属性,到底是忽略它还是根据程序需要进行相应的操作和处理。</p> <p>  当使用NodeType属性时,理解节点怎么联系到XML单元是非常重要的。例如,<wbr>看下列<wbr>XML元素:</wbr></wbr></p> <p><city>Chongqing</city><wbr></wbr></p> <p>  XMLtextReader<wbr>把这个元素看作<wbr>3<wbr>个节点,顺序如下:</wbr></wbr></wbr></p> <p>  1.<city>标签被读为类型<wbr>XMLNodeType.Element<wbr>节点,元素的名字“city”可从<wbr>XMLTextReader<wbr>的Name属性中获得。</wbr></wbr></wbr></wbr></p> <p>  2.文本数据“Chongqing”被读为类型为XMLNodeType.Text的节点。数据“Chongqing<wbr>”<wbr>可从XMLTextReader<wbr>的Value属性中取得。</wbr></wbr></wbr></p> <p>  3.</city>标签被读为类型为XMLNodeType.EndElement<wbr>节点。同样,元素的名称“city”可从XMLTextReader的Name属性中获得。</wbr></p> <p>  这是<wbr>3<wbr>种重要的节点类型,其它的类型在.NET的说明文档中有详细说明,请大家参阅相关资料。</wbr></wbr></p> <p>  如果XMLTextReader遇到一个错误,<wbr>例如出现违反XML句法的情况,它抛出一个System.XML.XMLException类型的异常。使用这个类的代码应该总是被保护<wbr>(<wbr>在Try……Catch块中),就像你以后在演示程序中看到的一样。<br>   本文只是一篇相当简单的介绍XMLTextReader<wbr>类的文章,XMLTextReader类有相当多的成员,在这里不可能一一述及。当读入XML数据时,XMLTextReader能提供相当强的灵活性。即便如此,我仍然进行了大量的论述,以保证读者能编制程序来实现现实世界中经常要求完成的任务,也就是从一个XML文件读取数据然后以HTML的格式输出,从而实现在浏览器中的显示。</wbr></wbr></wbr></wbr></p> <p>  这个ASP.NET程序(脚本)在服务器上运行并产生一个HTML页面返回浏览器。这段脚本程序在代码段<wbr>1<wbr>给出,它用来工作使用的<wbr>XML<wbr>数据文件在代码段<wbr>2给出。你能看到这个<wbr>XML<wbr>文件包含一份表示联系关系的列表;程序的目标即是将这个列表显示出来,为了更容易我们观察,这些列表已经被格式化了。</wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p>  运行程序:</p> <p>  1.<wbr>将代码段1存为XMLTextReader.ASPx文件,将代码段2存为XMLData.XML文件。</wbr></p> <p>  2.<wbr>把这两个文件都放在一个已经安装好.NET<wbr>框架的网络服务器的虚拟文件夹中。</wbr></wbr></p> <p>  3.<wbr>打开<wbr>Internet<wbr>Explorer<wbr>并且浏览这个ASPx文件,例如,在一个局域网服务器上,<wbr>URL<wbr>将是<wbr><img src="http://www.itonline.gd.cn/admin/article/pic/url.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="absmiddle"><a href="http://localhost/xmltextreader.ASPx%C2%A0%3Cwbr%3E" target="_blank"><span style="color:#525252">http://localhost/xmltextreader.ASPx<wbr></wbr></span></a>;。</wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p>  程序工作的大部分都由XMLDisplay<wbr>类来做,尤其是被ProcessXML()方法完成的。它每次读取一个节点XML数据,对于感兴趣的元素,节点数据和后跟冒号的节点名将和相应的HTML格式化标签一起写入输出结果中。在这阶段,“输出结果”由一个HTML文本暂时储存在其中的StringBuilder对象构成。</wbr></p> <p>  ProcessXML()方法是从LoadDocument()方法调用的。这个方法执行的任务是产生一个XMLTextReader实例化程序并在调用ProcessXML之前装载XML文件。它同时也处理异常,随后产生错误的信息并在浏览器中显示出来。最终该方法返回一个字符串,这个字符串或者包含产生的HTML内容,或者如果异常发生的话就包含出错信息,。</p> <p>  程序执行以Page_Load()程序开始,当浏览器请求浏览这个页面时,这一步会自动执行。这里的代码实例化了XMLDisplay<wbr>类并调用它的LoadDocument()方法。如果一切运行正常的话,格式化的HTML形式的返回值将被拷贝到页面的一个<div>标签中,生成的HTML文档被送回到浏览器中并显示出来。</wbr></p> <p>  其他的.NET<wbr>框架的类,比如XMLDocument类在读取XML数据方面表现如何呢?XMLDocument<wbr>类与XMLTextReader<wbr>类不同,它在存储器中创建整个XML文档的节点树。这样就可以随机的获得XML数据(与XMLTextReader<wbr>类获得数据的线性方式正好相反),并且在修改XML文件的数据和结构时,具有非常完美的灵活性。另外,XMLDocument允许执行XSLT<wbr>转变,不过,这些额外的功能是以运行速度的降低和系统资源的更多占用为代价的。<br>   代码段1:XmlTextReader.aspx</wbr></wbr></wbr></wbr></wbr></p> <p><%@<wbr>Import<wbr>Namespace="System.Xml"<wbr>%></wbr></wbr></wbr></p> <p><script<wbr>language="C#"<wbr>runat=server></wbr></wbr></p> <p>public<wbr>class<wbr>XmlDisplay<br> file://这个类读入并处理XML文件。<br> {</wbr></wbr></p> <p>public<wbr>string<wbr>LoadDocument(String<wbr>XmlFileName)<wbr>{<br> XmlTextReader<wbr>xmlReader<wbr>=<wbr>null;<br> StringBuilder<wbr>html<wbr>=<wbr>new<wbr>StringBuilder();<br> try<wbr>{<br> file://创建XMLTextReader的实例。<br> xmlReader<wbr>=<wbr>new<wbr>XmlTextReader(XmlFileName);<br> //<wbr>处理XML文件<br> html.Append(ProcessXml(xmlReader));<br> }<br> catch<wbr>(XmlException<wbr>ex){<br> html.Append("发生一个XML异常:"<wbr>+<wbr><br> ex.ToString());<br> }<wbr><br> catch<wbr>(Exception<wbr>ex){<br> html.Append("发生一个普通异常:"<wbr>+<wbr><br> ex.ToString());<br> }<wbr><br> finally<wbr><br> {<br> if<wbr>(xmlReader<wbr>!=<wbr>null)<br> xmlReader.Close();<br> }<br> return<wbr>html.ToString();<br> }</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p>private<wbr>string<wbr>ProcessXml(XmlTextReader<wbr>xmlReader)<wbr><br> {<br> StringBuilder<wbr>temp<wbr>=<wbr>new<wbr>StringBuilder();</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p>file://这个方法读入XML文件并生成输出的HTML文档。<br> while<wbr>(<wbr>xmlReader.Read()<wbr>)<wbr><br> {<br> //<wbr>处理一个元素节点的起始。<br> if<wbr>(xmlReader.NodeType<wbr>==<wbr>XmlNodeType.Element)<wbr><br> {<wbr><br> file://忽略<people>和<person>元素<br> if<wbr>((xmlReader.Name<wbr>!=<wbr>"person")<wbr>&amp;&amp;<wbr>(xmlReader.Name<wbr>!=<wbr>"people"))<wbr><br> {<br> file://如果是一个<category>元素,开始一个新的段落<br> if<wbr>(<wbr>xmlReader.Name<wbr>==<wbr>"category"<wbr>)<br> temp.Append("<p>");<br> file://添加元素名到输出中<br> temp.Append(<wbr>xmlReader.Name<wbr>+<wbr>":<wbr>"<wbr>);<br> }<br> }<br> //<wbr>处理文本节点<br> else<wbr>if<wbr>(xmlReader.NodeType<wbr>==<wbr>XmlNodeType.Text)<wbr><br> temp.Append(xmlReader.Value<wbr>+<wbr>"<br>");<br> file://处理元素节点的结尾<br> else<wbr>if<wbr>(xmlReader.NodeType<wbr>==<wbr>XmlNodeType.EndElement)<wbr><br> {<br> file://如果是<email>节点,添加结束段落的标记<br> if<wbr>(<wbr>xmlReader.Name<wbr>==<wbr>"email"<wbr>)<wbr><br> temp.Append("</p>");<wbr><br> }<wbr><br> }//结束while循环</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p>return<wbr>temp.ToString();</wbr></p> <p>}<wbr>file://结束ProcessXML方法</wbr></p> <p>}<wbr>file://结束XmlDisplay类</wbr></p> <p>private<wbr>void<wbr>Page_Load(Object<wbr>sender,<wbr>EventArgs<wbr>e){<br> file://创建XmlDisplay类的实例<br> XmlDisplay<wbr>XmlDisplayDemo<wbr>=<wbr>new<wbr>XmlDisplay();<br> output.InnerHtml<wbr>=<wbr>XmlDisplayDemo.LoadDocument(Server.MapPath("XMLData.xml"));<br> }<br> </script><br> <html><br> <head><br> </head><br> <body><br> <h2>演示XmlTextReader类</h2><br> <div<wbr>id="output"<wbr>runat="server"/><br> </body><br> </html></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></p> <p><wbr></wbr></p> <p><wbr></wbr></p> <p><wbr></wbr></p> <div style="border-right:#cccccc 1px solid; padding-right:5px; border-top:#cccccc 1px solid; padding-left:4px; font-size:13px; padding-bottom:4px; border-left:#cccccc 1px solid; width:98%; word-break:break-all; padding-top:4px; border-bottom:#cccccc 1px solid; background-color:#eeeeee"> <span style="color:#008080"><wbr>1</wbr></span><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><span style="color:#000000"><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">static</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">void</span><span style="color:#000000"><wbr>Main(</wbr></span><span style="color:#0000ff">string</span><span style="color:#000000">[]<wbr>args)<br></wbr></span><span style="color:#008080"><wbr>2</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span><span style="color:#000000">{<br></span><span style="color:#008080"><wbr>3</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>DateTime<wbr>d1<wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#000000">DateTime.Now;<br></span><span style="color:#008080"><wbr>4</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>XmlDocumentTest();<br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080"><wbr>5</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>DateTime<wbr>d2<wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#000000">DateTime.Now;<br></span><span style="color:#008080"><wbr>6</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>TimeSpan<wbr>ts<wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#000000">d2</span><span style="color:#000000">-</span><span style="color:#000000">d1<wbr>;<br></wbr></span><span style="color:#008080"><wbr>7</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080"><wbr>8</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>Console.WriteLine(ts.TotalMilliseconds)<wbr>;<wbr><wbr><wbr><wbr><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080"><wbr>9</wbr></span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>Console.Read()<wbr>;<br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080">10</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><br></span><span style="color:#008080">11</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>}</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span></span><span style="color:#000000"><br></span><span style="color:#008080">12</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><br></span><span style="color:#008080">13</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><br></span><span style="color:#008080">14</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">public</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">static</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">string</span><span style="color:#000000"><wbr>XmlFileName<wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#000000"><wbr></wbr></span><span style="color:#000000">"</span><span style="color:#000000">../../XML/1.xml</span><span style="color:#000000">"</span><span style="color:#000000">;<br></span><span style="color:#008080">15</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080">16</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">private</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">static</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">void</span><span style="color:#000000"><wbr>XmlTextReaderTest()<br></wbr></span><span style="color:#008080">17</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span><span style="color:#000000">{<br></span><span style="color:#008080">18</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>XmlTextReader<wbr>reader<wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">new</span><span style="color:#000000"><wbr>XmlTextReader(XmlFileName);<br></wbr></span><span style="color:#008080">19</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">while</span><span style="color:#000000"><wbr>(reader.Read()<wbr>)<br></wbr></wbr></span><span style="color:#008080">20</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span><span style="color:#000000">{<br></span><span style="color:#008080">21</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">bool</span><span style="color:#000000"><wbr>exit<wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#0000ff">false</span><span style="color:#000000">;<br></span><span style="color:#008080">22</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">switch</span><span style="color:#000000">(reader.NodeType)<br></span><span style="color:#008080">23</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span><span style="color:#000000">{<br></span><span style="color:#008080">24</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">case</span><span style="color:#000000"><wbr>XmlNodeType.Element<wbr>:<br></wbr></wbr></span><span style="color:#008080">25</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">break</span><span style="color:#000000">;<br></span><span style="color:#008080">26</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">case</span><span style="color:#000000"><wbr>XmlNodeType.Text<wbr>:<br></wbr></wbr></span><span style="color:#008080">27</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">if</span><span style="color:#000000"><wbr>(reader.Value</wbr></span><span style="color:#000000">==</span><span style="color:#000000">"</span><span style="color:#000000">last</span><span style="color:#000000">"</span><span style="color:#000000">)<br></span><span style="color:#008080">28</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span><span style="color:#000000">{<br></span><span style="color:#008080">29</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>exit</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#0000ff">true</span><span style="color:#000000">;<br></span><span style="color:#008080">30</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>}</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span></span><span style="color:#000000"><br></span><span style="color:#008080">31</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">break</span><span style="color:#000000">;<br></span><span style="color:#008080">32</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">case</span><span style="color:#000000"><wbr>XmlNodeType.EndElement<wbr><wbr>:<br></wbr></wbr></wbr></span><span style="color:#008080">33</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">break</span><span style="color:#000000">;<br></span><span style="color:#008080">34</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">default</span><span style="color:#000000">:<br></span><span style="color:#008080">35</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">break</span><span style="color:#000000">;<br></span><span style="color:#008080">36</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>}</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span></span><span style="color:#000000"><br></span><span style="color:#008080">37</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">if</span><span style="color:#000000">(exit)<br></span><span style="color:#008080">38</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span><span style="color:#000000">{<br></span><span style="color:#008080">39</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">return</span><span style="color:#000000">;<br></span><span style="color:#008080">40</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080">41</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>}</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span></span><span style="color:#000000"><br></span><span style="color:#008080">42</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><br></span><span style="color:#008080">43</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>}</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span></span><span style="color:#000000"><br></span><span style="color:#008080">44</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>}</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span></span><span style="color:#000000"><br></span><span style="color:#008080">45</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><br></span><span style="color:#008080">46</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">private</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">static</span><span style="color:#000000"><wbr></wbr></span><span style="color:#0000ff">void</span><span style="color:#000000"><wbr>XmlDocumentTest()<br></wbr></span><span style="color:#008080">47</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span><span style="color:#000000">{<br></span><span style="color:#008080">48</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>XmlDocument<wbr>xd<wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#0000ff">new</span><span style="color:#000000"><wbr>XmlDocument()<wbr>;<br></wbr></wbr></span><span style="color:#008080">49</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>xd.Load(XmlFileName)<wbr>;<br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080">50</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>XmlNode<wbr>node<wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#000000">=</span><span style="color:#000000"><wbr>xd.SelectSingleNode(</wbr></span><span style="color:#000000">"</span><span style="color:#000000">/people/person[category='last']</span><span style="color:#000000">"</span><span style="color:#000000">);<wbr><br></wbr></span><span style="color:#008080">51</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>Console.Write(node.Name)<wbr>;<wbr><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008080">52</span><span style="color:#000000"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" alt="XMLTextReader和XmlDocument读取XML文件的比较(转)" title="XMLTextReader和XmlDocument读取XML文件的比较(转)" align="top"><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>}</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span></span> </div> </wbr>

你可能感兴趣的:(document)