将数据写入xml文档的问题~!!! - .NET技术 / C#
我用以下代码将一组FORM的数据存储到XML文档可以实现,但是当我再次调用该函数的时候,就会覆盖前面保存的数据,如果我想在以保存的数据下面继续保存写入的数据改怎么写,麻烦个位帮个忙指点下,呵呵~!!!
public void XmlDocument()
{
string ServerIp = this.ServerIpBox.Text;
string ServerName = this.ServerNameBox.Text;
string ServerPort = this.ServerPortBox.Text;
string UserName = this.UserNameBox.Text;
string UserPwd = this.UserPwdBox.Text;
XmlDocument doc = new XmlDocument();
XmlElement friendsinfo = doc.CreateElement("ViewManage");
XmlDeclaration sm = doc.CreateXmlDeclaration("1.0", "GB2312", "no");
doc.AppendChild(sm);
doc.AppendChild(friendsinfo);
XmlElement hy = doc.CreateElement("ViewPara");
hy.SetAttribute("nodeText", ServerName);
XmlElement ip = doc.CreateElement("IP");
ip.AppendChild(doc.CreateTextNode(ServerIp));
hy.AppendChild(ip);
XmlElement port = doc.CreateElement("Port");
port.AppendChild(doc.CreateTextNode(S
相关问答:
DataSet导出xml 批处理(循环)得怎么处理
XML文件
<A>
<B>
<C>
</C>
&nb ......
我有一个类似的xml的 string,想通过遍历怎么个xml 输出我想要的element的值
xml 为:
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_ME ......
现在有个xml文件是<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......
XML文件内容:
- <ResList>
<page>0</page>
- <resItem>
<resName>WWW</resName>
</resItem>
- <resItem>
&nb ......
求一本C#设计模式的书 ,我感觉我的代码运用接口,委托,属性的地方很少,肯定是我的设计模式太差了 ,有没有这方面,从国外翻译过来的,比较好的设计模式的书,推荐一下吧,非常感谢.
高人们说 代码重构的书好些,那我要改看 ......