您的位置:首页 >> 编程开发 >> .NET >> XML/SOAP >> 正文
RSS
 

C#中使用XML——编写XML

http://www.rdxx.com 05年07月27日 21:36 CSDN 我要投稿

关键词: C# , XML
this.button1);

                this.Controls.Add(this.textBox1);

                this.Name = "Form1";

                this.Text = "XMLWriting";

                this.ResumeLayout(false);

 

           }

           #endregion

 

           /// <summary>

           /// 应用程序的主入口点。

           /// </summary>

           [STAThread]

           static void Main()

           {

                Application.Run(new Form1());

           }

 

           private void button1_Click(object sender, System.EventArgs e)

           {

                this.textBox1.Text = string.Empty;

                const string fileName = "WriteXml.xml";

 

                XmlTextWriter xmlTxtWt = new XmlTextWriter(fileName,Encoding.UTF8);

               

                // XML文档声明

                xmlTxtWt.WriteStartDocument();

                // XML起始元素

                xmlTxtWt.WriteStartElement("ct","ContactDetails","http://www.deltabis.com/Contact");

                // 写文本

                xmlTxtWt.WriteString("This is a XML file");

                // XML结束元素

                xmlTxtWt.WriteEndElement();


 
 
标签: C# , XML 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站