简体   繁体   English

Visual C#中的XML输出

[英]XML Outputs in Visual C#

I used this method (serialization) to create data (skills) into a combo-box. 我使用此方法(序列化)将数据(技能)创建到组合框中。 I can select a player, a skill rate it and then save a comment and it writes to an xml skill. 我可以选择一个玩家,为其评分,然后保存评论,然后将其写入xml技能。

I am hoping to be able to do this for multiple combo-boxes (one for each skill) or, be able to choose a different skill in 1 combo-box, rate it and write it until all skills have a rating and are written. 我希望能够针对多个组合框(每个技能一个)执行此操作,或者希望能够在1个组合框中选择不同的技能,对其进行评分并编写,直到所有技能都获得评分并被写作为止。

Currently, I can only save 1 skills to 1 user. 目前,我只能将1个技能保存给1个用户。 I have 12 skills and I'd like to rate each one and save it to an XML document. 我有12个技能,我想对每个技能进行评分,然后将其保存到XML文档中。

If I do it for 1 person, 1 skill and 1 rating it works. 如果我为1个人,1个技能和1个等级进行评估,那么它可以工作。 But if I change person, change skill and rate the skill, it overwrites the existing XML document. 但是,如果我更改人员,更改技能和评价技能,它将覆盖现有的XML文档。

So how can I easily successfully write Multiple XML's (or multiple players) with multiple skills and ratings? 那么,如何才能轻松成功地编写具有多种技能和等级的多个XML(或多个播放器)呢?

1 document could = Player Name, 12 skills aka (Standard, pop, push etc) (its football skills), with a rating for each of the 12 skills? 1个文件可以=球员名称,12个技能(又称标准,流行,推杆等)(足球技能),并为12个技能中的每一个评分?

See my full answer in following post : how do I generate data from an xml file in html . 请参阅以下文章,了解我的完整答案: 如何从html中的xml文件生成数据 The class below uses a List to create an array of elements. 下面的类使用List创建元素数组。

 [XmlRoot("root")] public class Root { [XmlElement("element")] public List<Element> elements {get;set;} } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM