用c#编window应用程序来读写xml文件里的客户端配置信息

问题描述

我新学c#,老师给了5个xml文件,让我编个window程序读出里面的相关信息,并能在程序界面中进行修改,修改完还能再保存回xml第一个文件,ApplicationClientOptions.xml?xmlversion="1.0"?><Options><IsAutoLogin>False</IsAutoLogin><IsSaveUserInfomation>True</IsSaveUserInfomation><UserID>youbing</UserID><UserPassword></UserPassword><SkinName>Office2007Black</SkinName><IsStatusBarVisible>True</IsStatusBarVisible><IsToolBarVisible>True</IsToolBarVisible><IsUseTabbed>True</IsUseTabbed><RemoteServerList><RemoteServer>Base_Service.xml</RemoteServer><RemoteServer>Edcp_Service.xml</RemoteServer></RemoteServerList></Options>第2个<?xmlversion="1.0"?><AutoUpdateConfig><ServerAddress>http://192.168.60.5:6235</ServerAddress></AutoUpdateConfig>第3个</object><objectid="BaseRemoteServiceConfig"type="Eep.Framework.ClientUtils.RemoteServiceConfig,Eep.Framework.ClientUtils"init-method="Initialize"><propertyname="Name"value="基础应用远程服务"/><propertyname="Description"value="这个服务主要提供应用基本的服务"/><propertyname="ConfigFileName"value="BaseRemoteService.xml"/><propertyname="RemoteServiceProtocol"value="http"/><propertyname="RemoteServiceAddress"value="192.168.60.8"/><propertyname="RemoteServicePort"value="7250"/></object></objects>第4个<objectid="EdcpRemoteServiceConfig"type="Eep.Framework.ClientUtils.RemoteServiceConfig,Eep.Framework.ClientUtils"init-method="Initialize"><propertyname="Name"value="协同平台远程服务"/><propertyname="Description"value="这个服务主要提供协同平台的远程数据服务"/><propertyname="ConfigFileName"value="EdcpRemoteService.xml"/><propertyname="RemoteServiceProtocol"value="http"/><propertyname="RemoteServiceAddress"value="192.168.1.5"/><propertyname="RemoteServicePort"value="3562"/></object>第5个,<?xmlversion="1.0"?><configuration><configSections><sectionGroupname="spring"><sectionname="context"type="Spring.Context.Support.ContextHandler,Spring.Core"/><sectionname="objects"type="Spring.Context.Support.DefaultSectionHandler,Spring.Core"/><sectionname="parsers"type="Spring.Context.Support.ConfigParsersSectionHandler,Spring.Core"/></sectionGroup></configSections><system.runtime.remoting><application><channels><channelref="http"><clientProviders><formatterref="binary"/><providertype="Eep.Framework.ExtendUtils.Remoting.AuthenticationClientSinkProvider,Eep.Framework.ExtendUtils"customSinkType="Eep.Framework.ExtendUtils.Remoting.AuthenticationClientSink,Eep.Framework.ExtendUtils"/></clientProviders></channel></channels></application></system.runtime.remoting></configuration>我本来想创建个程序应用窗口,直接读进来,然后修改后再写回去,,结果读的进来,不知道怎么写回去,不知道怎么创建一个对象把xml文档读到一个xmldocument对象里,以后让程序窗口的读取这个对象操作,大家能帮这个忙么?谢谢,在线等

解决方案

解决方案二:
在第一个文件中程序选择好远程服务类型,底下的相关信息要随之变化,就是3,4,文件里的相关信息,,这个怎么解决也请帮助,
解决方案三:
您可以引一个usingSystem.Xml;其中:XmlDocumentdoc=newXmlDocument();doc.Load("xml的文件名");XmlNodenode=doc.SelectSingleNode("//节点的名称");....这是查找指定的某个节点,还有很多内容,你可以上msdn上找一下,很全的.
解决方案四:
我能读进来,,关键是现在我不会创建一个对象,,把xml文档读到一个xmldocument对象里,然后的读取对这个对象操作,这我不会,而且像这个<propertyname="Description"value="这个服务主要提供协同平台的远程数据服务"/>,我怎么提前中间的文字,
解决方案五:
if(File.Exists(filePath)){List<SystemPatches>tempList=newList<SystemPatches>();XmlSerializermySerializer=newXmlSerializer(typeof(List<SystemPatches>));using(FileStreammyFileStream=newFileStream(filePath,FileMode.Open)){tempList=(List<SystemPatches>)mySerializer.Deserialize(myFileStream);}systemPatchesList.AddRange(tempList);}XmlSerializerxmlSerializer=newXmlSerializer(typeof(List<SystemPatches>));using(StreamWritermyWriter=newStreamWriter(filePath)){xmlSerializer.Serialize(myWriter,systemPatchesList);}序列化和反序列化XML

时间: 2024-08-31 13:55:05

用c#编window应用程序来读写xml文件里的客户端配置信息的相关文章

读写xml文件的2个小函数

xml|函数 #region 读写xml文件的2个小函数,2005 4 2 by hyc  public void SetXmlFileValue(string xmlPath,string AppKey,string AppValue)//写xmlPath是文件路径+文件名,AppKey是 Key Name,AppValue是Value  {   XmlDocument xDoc = new XmlDocument();   xDoc.Load(xmlPath);   XmlNode xNod

求助:通过程序实现把视频文件里的声音转换为文字输出

问题描述 求助:通过程序实现把视频文件里的声音转换为文字输出用JAVA实现或通过JAVA调用其他程序或命令试实现最好. 解决方案

用C#读写XML文件

问题描述 1.用C#读写XML文件2.将XML文件显示在文字框或者表格中求代码,讲解··· 解决方案 解决方案二: 解决方案三: 谢谢····段子鹏解决方案四: 不是用linq,是C#···解决方案五: 读///<summary>///根据节点名称读取PersonalAccountSettings.xml中节点的InnerText值///</summary>///<paramname="nodeName">节点名称</param>///&

在MFC程序中使用XML文件配置工具栏

现在我发现使用Visual Studio的资源编辑器进行编辑资源有着诸多的不便:首先是任何资源的变动一般变动代码,不利于系统维护,其次Visual Studio的资源编辑器的本身的功能有限,也不利于界面美化,三是不利于人员分工,开发人员既要忙实现功能,又要忙准备好的界面素材.对界面实现文件配置化正是解决上面问题的好方法.这次我实现了使用XML文件配置工具栏.这里所谓配置就是工具栏的界面信息如工具栏标题.按钮图片.是否为分隔符都在XML文件保存,程序通过解析XML文件来获取工具栏信息来创建工具栏.

Vc 读写xml文件二个实例

vc 读写xml文件二个实例 <?xml version="1.0" encoding="gb2312"?>   <root> <device id="10041" name="设备1">   <type>13 </type>   <typename>保护 </typename>   </device>  </root>

读写xml文件的2个小函数_XML示例

要利用DOM 来存取XML 文件,你必须将XML 文件连结到HTML 网页上. #region 读写xml文件的2个小函数,2005 4 2 by hyc  public void SetXmlFileValue(string xmlPath,string AppKey,string AppValue)//写xmlPath是文件路径+文件名,AppKey是 Key Name,AppValue是Value { XmlDocument xDoc = new XmlDocument(); xDoc.L

C#写一个读写XML文件的程序

问题描述 写一程序可以修改写入读取XML文件的程序 解决方案 解决方案二:学习一下:解决方案三: 解决方案四:XDocument,XmlDocument,XmlSerializer都可以,看需求了.解决方案五://利用递归获取xml的所有节点(元素也是节点)publicvoidRecurseXml(XmlNoderoot,intindex){if(root==null){return;}if(rootisXmlElement){tbxContent.Text+=root.Name.PadLeft

java学习:使用dom4j读写xml文件

dom4j是一个优秀的开源项目,专用于xml文件的读写,而且支持强大的xpath. 下面的代码演示了对xml文件demo.xml的读写 demo.xml内容: 1 <?xml version="1.0" encoding="UTF-8" ?> 2 <address-list> 3 <card name="yangjm" id="1"> 4 <sex>男</sex> 5

Linux Shell脚本读写XML文件

在Linux下如何用Shell脚本读写XML?现有一个config.xml <?xml version="1.0" encoding="UTF-8"?><config>   <server-ip>192.168.1.45</server-ip>   <server-port>1209</server-port>   <repository-temp-path>/home/john&l