如何在ASP.NET中使用XML文件 [英] How to work with XML files in ASP.NET

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

问题描述



我试图理解XML文件的概念.我读了很多文章,现在我很困惑!

首先,我是否应该通过后台代码页面创建XML文件并使用xmlwriter进行写入还是感到困惑,还是应该直接打开XML文件并在其中写入内容?
我尝试通过代码隐藏创建许多XML文件,但该文件已创建,但是我无法在AdRotator和RSS Feed中使用它们.

我想知道如何创建在其子元素中具有Url文件的XML文件.

如果有人简短地指导我并清除我的疑问,我将非常感激.
在此先感谢您.

Hi,

I am trying to understand the concept of XML file. I have gone through many articles and i am very much confused now!

First of all, i am confused if i should create a XML file through codebehind page and use xmlwriter to write in it OR should i directly open the XML file and write the contents in it?
I tried creating many XML files through codebehind and it gets created but i am unable to use them in AdRotator & RSS Feed.

I want to know how can i create XML file that has Url''s of files in its child element.

I will be very thankful if anybody guide me in brief and clear my doubts.
Thanks in advance.

推荐答案

好吧,您说您读了很多文章.我不知道是什么让您感到困惑.可以从此处开始. [示例 [ ^ ]此处.

如下所示的简单xml有什么问题

Well you said you read many articles. I don''t know what is confusing you. May be start from here.[^] and examples[^] here.

What is wrong with simple xml as follows

<?xml version="1.0">
<Tutotial>
  <Url>http://www.codeproject.com/</Url>  
</Tutotial>


XML文件是文本.您所做的取决于您的需求.我建议购买一本有关XML的基本书,因为您似乎毫无头绪.
An XML file is text. What you do depends on your needs. I suggest buying a basic book on XML, because you appear to have no clue.


您可以通过添加名称空间 Imports System.xml;

如果您想读取xml内容,则只需使用XMLReader类
如果要编写xml,则只需使用xmlWriter类
您还可以使用XMLdocument来阅读和编写文档.

问候
koolprasad2003:)
You can deal with xml by just adding namespace Imports System.xml;

if you want to read the xml content then just use XMLReader class
if you want to write the xml then just use xmlWriter class
you can also use XMLdocument for reading n writing purpose.

regards
koolprasad2003 :)


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

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