从后面的代码中以xml格式编写 [英] write a in xml from code behind
本文介绍了从后面的代码中以xml格式编写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想从现有xml文件中的* .cs文件在asp.net的xml节点中编写文本框文本.
在此先感谢
Hi guys,
I want to write a textbox text in xml node in asp.net from *.cs file in existing xml file.
Thanks in advance
推荐答案
string filename = @"c:\test\XMLFile.xml";
XmlDocument doc = new XmlDocument();
doc.Load(filename);
XmlNode node = doc.CreateNode(XmlNodeType.Element, "New Node name", null);
node.InnerText = "this is text from your textbox";
doc.DocumentElement.AppendChild(node);
doc.Save(filename);
在相同的CodeProject中有许多可用的教程.这是其中一些
使用XPath和XmlDocument(C#)操纵XML数据 [以最简单的方式在C#中使用XML [带有XML文件的C#应用程序 [
There are number of Tutorials available in CodeProject on the same. Here is some of them
Manipulate XML data with XPath and XmlDocument (C#)[^]
Using XML in C# in the simplest way[^]
C# Application with XML File[^]
Go through the tutorials. You will able to understand the stuff better and then do the stuff yourself.
Cheers !
这篇关于从后面的代码中以xml格式编写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文