用C#创建XML[简单代码]
XmlDocument doc = new XmlDocument();
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "GB2312", null);
doc.AppendChild(dec);
//创建一个根节点(一级)
XmlElement root = doc.CreateElement("First");
doc.AppendChild(root);
//创建节点(二级)
XmlNode node = doc.CreateElement("Seconde");
//创建节点(三级)
XmlElement element1 = doc.CreateElement("Third1");
element1.SetAttribute("Name", "Sam");
element1.SetAttribute("ID", "665");
element1.InnerText = "Sam Comment";
node.AppendChild(element1);
XmlElement element2 = doc.CreateElement("Third2");
element2.SetAttribute("Name", "Round");
element2.SetAttribute("ID", "678");
element2.InnerText = "Round Comment";
node.AppendChild(element2);
root.AppendChild(node);
doc.Save(@"E:\bb.xml");
Console.Write(doc.OuterXml);
相关文档:
创建一个Winform用户控件 UserControl1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace MyActiveT ......
假设xml文件是
<?xml version="1.0" encoding="gb2312" ?>
- <books auth="wren">
- <book id="B01">
<name>哈里波特 </name>
<price>10 </price>
<memo>这是一本很好看的书。 </memo>
</book>
- <boo ......
XML的产生?
XML的全称是Extensible Markup Language,意思是可扩展的标记语言,它是标准通用标记语言(Standard Generalized Markup Language, SGML)的一个子集。SGML功能非常强大,是可以定义标记语言的元语言。
W3C组织于2004年2月4日,发布了XML1.1的推荐标准,这是最新的XML版本,不过目前大多数的应用还是基于XML1.0的 ......
转自江边孤鸟: http://blog.csdn.net/jbgh608/archive/2007/08/31/1767414.aspx
W3school 的xsl教程: http://www.w3school.com.cn/xsl/index.asp
产品几年前使用ASP,后来升级到.Net 1.1,再升级到2.0,一直都有用XSLT转换XML生成网页的方式,稍微整理下。
XML file:
<?xml version="1.0"& ......