如何使用Xmlreader移动到XML文件中的上一行 [英] How to move to previous line in XML file using Xmlreader

查看:92
本文介绍了如何使用Xmlreader移动到XML文件中的上一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读一个XML文件。

如果我读了一行< book type =Comic>



它应该回到先前读取的行< issues>





如何使用XMLreader执行此操作。





 <  问题 >  
< 文章 id = 1 >
< / Article >
< ; Book type < span class =co取消关键字> = 漫画 >
< / Book >
< span class =code-keyword>< /问题 >





我读了

 <   book     type   = 漫画 >  

它应该移动to

 <   article     id   =  1 >  





怎么做

解决方案

你不能,请参阅 http://msdn.microsoft.com/en-us/library上的说明/vstudio/system.xml.xmlreader [ ^ ]。如果您想随机访问XML数据,那么您应该使用 XML文档对象型号 [ ^ ]。

I am reading an XML file.
If I get read a line having <book type="Comic">

It should move back to previously read line <issues>


How to do this using XMLreader.


<Issues>
<Article id=1>
</Article>
<Book type="Comic">
</Book>
</Issues>



I read the line

<book type="Comic">

it should move to

<article id="1">



How to do this

解决方案

You can't, see the description at http://msdn.microsoft.com/en-us/library/vstudio/system.xml.xmlreader[^]. If you want random access to your XML data then you should use the XML Document Object Model[^].


这篇关于如何使用Xmlreader移动到XML文件中的上一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆