问题描述
如何利用xml作为数据存储,实现用户名,密码登录,以及将Textbox的内容修改保存文xml格式,代码怎么编写
解决方案
解决方案二:
XmlDocument我只能帮你到这了...
解决方案三:
staticvoidLoadKeyValueXml(){stringxml=@"<?xmlversion=""1.0""encoding=""GBK""?><root><keyValue><key><![CDATA[birthday]]></key><value><![CDATA[1969-12-01]]></value></keyValue><keyValue><key><![CDATA[sex]]></key><value><![CDATA[1]]></value></keyValue><keyValue><key><![CDATA[businessScope]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[businessLicenseNo]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[otCardType]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[businessContacter]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[initialPassword]]></key><value><![CDATA[111111]]></value></keyValue><keyValue><key><![CDATA[registeredCapital]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[cardType]]></key><value><![CDATA[1]]></value></keyValue><keyValue><key><![CDATA[ip]]></key><value><![CDATA[36.18.35.99]]></value></keyValue><keyValue><key><![CDATA[organizationCode]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[taxRegistrationNo]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[vocation]]></key><value><![CDATA[XX]]></value></keyValue><keyValue><key><![CDATA[enterpriseKind]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[ContacterPhoneNo]]></key><value><![CDATA[13917852203]]></value></keyValue><keyValue><key><![CDATA[legalRepresentative]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[otCardNumber]]></key><value><![CDATA[]]></value></keyValue><keyValue><key><![CDATA[cardNumber]]></key><value><![CDATA[370223196912012773]]></value></keyValue></root>";XElementroot=XElement.Parse(xml);List<KeyValuePair<string,string>>list=newList<KeyValuePair<string,string>>();foreach(varkvEinroot.Elements("keyValue")){KeyValuePair<string,string>kv=newKeyValuePair<string,string>(kvE.Element("key").Value,kvE.Element("value").Value);list.Add(kv);}}
LinqToXML只能帮你到这里了