打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
读取XML文件
读取XML文件: 
using System; 
using System.Xml;  

class TestReadXML 

public static void Main() 


XmlTextReader reader = new XmlTextReader("C:\\test.xml"); 
reader.Read(); 

while (reader.Read()) 
{  
reader.MoveToElement(); 
Console.WriteLine("XmlTextReader Properties Test");
Console.WriteLine("===================");  

// Read this properties of element and display them on console 

Console.WriteLine("Name:" + reader.Name); 
Console.WriteLine("Base URI:" + reader.BaseURI); 
Console.WriteLine("Local Name:" + reader.LocalName); 
Console.WriteLine("Attribute Count:" + reader.AttributeCount.ToString()); 
Console.WriteLine("Depth:" + reader.Depth.ToString()); 
Console.WriteLine("Line Number:" + reader.LineNumber.ToString()); 
Console.WriteLine("Node Type:" + reader.NodeType.ToString()); 
Console.WriteLine("Attribute Count:" + reader.value.ToString()); 
}  
}  
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
HOW TO:使用 Visual C
如何完成.Net下XML文档的读写操作
C#入门代码 - C Programmer's Cookbook - C 博客
字符串序列化时碰到的小问题
C#使用Linq操作Xml文件(创建xml文件、增删改查xml文件节点信息)的方法
应用程序配置和动态加载2----创建程序集
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服