如何把Asp.net文本内容写到XML文档里

来源:百度知道 编辑:UC知道 时间:2024/04/28 01:36:44
如何实现Asp.net与XML的关联?

public void CreateXml( String XmlFilename, String content )
{
XmlTextWriter xtw = new xtw( XmlFilename, System.Text.Encoding.GetEncoding("GB2312") );
xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument();
xtw.WriteStartElement( "Root" );
xtw.WriteStartElement( "Node" );
xtw.WriteElementString( "content", content );
xtw.WriteEndElement();
xtw.WriteEndElement();
xtw.WriteEndDocument();
xtw.Flush();
xtw.Close();
}