如何在C#中读取xml标记 [英] how to read an xml tag in c#

查看:77
本文介绍了如何在C#中读取xml标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#2.0中读取xml标记

how to read an xml tag in c# 2.0

推荐答案

我建​​议您使用Google搜索类似"c#读取XML"的内容,这将使您入门.
我还建议您阅读网站常见问题解答以及有关如何提出问题的指南,您所提出的问题不要陈述您尝试过的内容(人们不会做任何事情,并且您想为您编写代码)或出现问题的地方,您的问题缺少有关您要实现的目标的详细信息.
I suggest you google something like "c# read XML", that will get you started.
I also suggest you read the site FAQs and the guidance about how to ask a question, you question doesn''t state what you have tried (people will assume nothing and that you want code written for you) or what has gone wrong, also your question lacks detail about what you are trying to achieve.


一种读取和分解XML数据的方法是通过 ^ ] s.看看本教程 [ ^ ].它具有相对简单的语法 [
One way to read and break down XML data is via XPath[^]s. Take a look at this tutorial[^]. It has a relatively simple syntax[^] and is quite easy to use.

Regards,

Manfred


为此,您可以尝试通过Xml标签阅读它的有效代码:
You try for this it is working code by this you can read Xml tags:
private void Button1_Click(object sender, EventArgs e)
    {
            
    XmlTextReader reader = new XmlTextReader("C:\\Users\\Dell\\Desktop\\New folder\\XMLFile1.xml");   //This is path n name of xml file

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                   case XmlNodeType.Element: 
                         MessageBox.Show("<" + reader.Name);
                         break;
                 }
             }
    }


关于任何有关XML的查询,那么随时欢迎...


regarding any query about XML then always welcome...


这篇关于如何在C#中读取xml标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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