peliman 0 Posted July 5, 2014 Report Share Posted July 5, 2014 (edited) Hi! I'm making php program which saves automatically game stats. I have thought .xml would be right format because javascript can read it.The problem is that it should be easy to navigate. The stats will be saved every day, so easiest way to navigate would be by date. --year 2014----month 1------day 1---------player 1---------player 2etc. ^How should I write that in .xml? Or is .xml totally wrong format to do that? <year2014>...</year2014><year2013>...</year2013> ^I have understood that it isn't way to do it. Same basic elements should have same name. <year id=2014>...</year> ^Is id right way to do it? Thanks in advance Edited July 6, 2014 by peliman Quote Link to post Share on other sites
L8V2L 5 Posted July 5, 2014 Report Share Posted July 5, 2014 (edited) Here's an example: <gameStats> <gamer> <date> <year>2014</year> <month>1</month> <day>1</day> </date> <player>1</player> </gamer></gameStats> Edited July 5, 2014 by L8V2L Quote Link to post Share on other sites
peliman 0 Posted July 5, 2014 Author Report Share Posted July 5, 2014 Hmm... finding data there would be slow. Server should read every line to find the right day. Treeview by date would make it fast and easy to use.Is there any proper way to do it? Quote Link to post Share on other sites
L8V2L 5 Posted July 5, 2014 Report Share Posted July 5, 2014 (edited) xml is making your own tag, you can shorten iit down. I just gave you an example of what is said to be the best way to do it. What langauge do you prefer, what programing do you practice in? Edited July 5, 2014 by L8V2L Quote Link to post Share on other sites
peliman 0 Posted July 6, 2014 Author Report Share Posted July 6, 2014 (edited) I'm using php and javascript. I wouldn't use .xml if javascript could read data from other file format. Using your way to save data, there would be thousands of blocks data without any order. Finding specific data would be slow. For instance searching one block as below. There is 2 possible situation for year, 12 for month, 32 for day, 4 for gamemode, 3 for faction and 20 for rank. Day: 3.6.2014Gamemode: NormalFaction: TerroristRank: 5 If it was arranged, finding data would be fast. There would be fewer options. Server should only look 73 different situation. If they weren't arranged, it would be 184320. Arranged is more than 25x faster. If it isn't possible to arranged data by date in .xml, should I use folders and many .xml files to make it arranged? Edited July 6, 2014 by peliman Quote Link to post Share on other sites
L8V2L 5 Posted July 6, 2014 Report Share Posted July 6, 2014 (edited) Have you consider JSON? "use strict";var gameStats = { player1date:[ {year:2014, month:1, day:1} ]}gameStats.player1date[0].year;//2014 Edited July 6, 2014 by L8V2L Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.