随笔分类 -  XML

摘要://加载指定的XML文档 XmlDocument doc = new XmlDocument(); doc.Load("sampledata2.xml"); //或者通过 XmlDocument 载入 XmlTextReader 类的对象来加载XML文件 //XmlTextReader reader = new XmlTextReader("sampledata.txt"); //doc.Load(reader); //读取XML节点数据 X... 阅读全文
posted @ 2013-01-15 10:52 wouldguan 阅读(769) 评论(0) 推荐(0)
摘要:XmlTextWriter textWriter = new XmlTextWriter("sampledata2.xml", null); //设置格式,对元素内容进行缩进 textWriter.Formatting = Formatting.Indented; //书写XML声明 textWriter.WriteStartDocument(); //写出在名称和文本之间带有空格的处理指令 String pitext = "type='t... 阅读全文
posted @ 2013-01-15 10:35 wouldguan 阅读(342) 评论(0) 推荐(0)
摘要://创建一个空的xml文档 XmlDocument xmldoc = new XmlDocument(); //在xml文档最头部加入xml的声明段落 //<?xml version="1.0"?> XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", ""); xmldoc.AppendChild(xmlnode); //增加注释 Xm... 阅读全文
posted @ 2013-01-14 23:30 wouldguan 阅读(384) 评论(0) 推荐(0)