I have the following XML file:
And this code:Code:<map gsid="101"> <name> Dalian Plant </name> <briefing locid="LOADINGSCREEN_MAPDESCRIPTION_dalianplant">map description for modders maps not localized (english only)</briefing> <music> common/sound/menu/music/load_CH_music.ogg </music> <modes> <mode type="gpm_cq"> <maptype ai="1" players="16" type="doubleassault" locid="GAMEMODE_DESCRIPTION_doubleassault">Unlocalized test for this mode on this map</maptype> <maptype players="32" type="headon" locid="GAMEMODE_DESCRIPTION_headon">Unlocalized test for this mode on this map</maptype> <maptype players="64" type="headon" locid="GAMEMODE_DESCRIPTION_headon">Unlocalized test for this mode on this map</maptype> </mode> <mode type="gpm_coop"> <maptype ai="1" players="16" type="doubleassault" locid="GAMEMODE_DESCRIPTION_COOP_doubleassault">Unlocalized test for this mode on this map</maptype> </mode> </modes> </map>
I need my output to be:Code:string gpm = ""; System.Data.DataSet ds = new System.Data.DataSet(); ds.ReadXml(MapFileName); foreach(System.Data.DataRelation myRelation in ds.Tables["mode"].ChildRelations) { foreach(System.Data.DataRow myRow in ds.Tables["mode"].Rows) { foreach(System.Data.DataRow childrow in myRelation.ChildTable.Rows) { gpm = gpm + myRow["type"] + "," + childrow["players"] + "/"; } } } return gpm;
"gpm_cq,16/gpm_cq,32/gpm_cq,64/gpm_coop,16"
but it's not working the way I want.




Reply With Quote