cry of war Posted February 29, 2008 Share Posted February 29, 2008 I am creating a website that I want to use XML files as storage. I have ran into a few problems or concerns on the topic and was wondering if you could help me. 1. Will people be able to view the XML files if they know the root of the dir. 2. Will I be able to add/delete nodes without having to rewrite the whole file. 3. Is there a better way to do this? Thank you for your time. Quote Link to comment Share on other sites More sharing options...
Liquid Fire Posted February 29, 2008 Share Posted February 29, 2008 1. you might be able to restrict direct access to the file and/or directory through apache configuration 2. not sure about this one 3. I would use a database for most of the data storage. Quote Link to comment Share on other sites More sharing options...
trq Posted February 29, 2008 Share Posted February 29, 2008 1. If it is publicly accessible. 2. Yes. 3. Use a database. Quote Link to comment Share on other sites More sharing options...
aschk Posted February 29, 2008 Share Posted February 29, 2008 I think the problem you're going to have with an XML is relationships. XML is great at storing tree heirarchy, and sets of information, but unfortunately is rubbish at being a relational model. The biggest problem you face is getting back searches/joins between your xml files. Best get to learning xpath Quote Link to comment Share on other sites More sharing options...
cry of war Posted February 29, 2008 Author Share Posted February 29, 2008 The reason I want to use xml is because there are some areas that i think will be to complex for the DB server or my skill in SQL DB is horrible. For example I am making a game. The users have weapons and those weapons have certain skills that they can use having different ranges attack power and so on. If my admins wanted to one of them i would have to creat a new column in the SQL table but if I were to make it in the XML file i could Add up to millions of Skills on that one weapon. Quote Link to comment Share on other sites More sharing options...
aschk Posted February 29, 2008 Share Posted February 29, 2008 Weapons have skills My friend, think about it this way: Weapons have attributes (range, recharge time, weight) People have skills (quick fire, slow fire, arcane shot) There's no reason why this can't be stored in a database. Blizzard do it for World of Warcraft easily enough... Quote Link to comment Share on other sites More sharing options...
cry of war Posted February 29, 2008 Author Share Posted February 29, 2008 ok let me re-phrase that weapon skills= weapon arts And there is alot more of these so you have to remember that im turning i think it was 46 tables into 1 (User log info)plus XML sheets if I use XML Data base examples Weapons /--------------\/--------------\/--------------\/--------------\ |-----ID-------|-----Name-----|---StrBonus---|----Agility-----|and so on \--------------/\--------------/\--------------/\--------------/ |-----1--------|-Throwing Axe-|-----1---------|---9----------| |-----2--------|-Meat Cleaver-|-----99--------|----3---------| Arts /--------------\/--------------\/--------------\/--------------\/--------------\ |-----ID-------|-----Name-----|------Bonus---|----Alignment-|----Target-----| \--------------/\--------------/\--------------/\--------------/\--------------/ |-----1--------|-Lucky Shot---|-----Luck------|---10---------|----1-----| |-----1--------|-Lucky Shot---|-----Accuarcy-|---7---------|----1-----| |-----2--------|-Mad Man-----|-----Strength--|----3---------|----1-----| |-----1--------|-Sniper--------|-----Accuarcy-|---9----------|----1-----| |-----2--------|-Dismember---|-----Speed-----|-----6---------|----2-----| xml <?xml version="1.0" encoding="ISO-8859-1"?> <Weapons> <Weapon> <ID>#156763453</ID> <Name>Throwing Axe</Name> <Art> <ID>#1456378342</ID> <Name>Lucky Shot</Name> <Effect> <Bonus>Luck</Bonus> <Alignment>10</Alignment> <Target>1</Target> </Effect> <Effect> <Bonus>Accuarcy</Bonus> <Alignment>7</Alignment> <Target>1</Target> </Effect> </Art> <Art> <ID>#183243748735</ID> <Name>Sniper</Name> <Effect> <Bonus>Accuarcy</Bonus> <Alignment>9</Alignment> <Target>1</Target> </Effect> </Art> </Weapon> <Weapon> <ID>#9845868</ID> <Name>Meat Cleaver</Name> <Art> <ID>#1488784685</ID> <Name>Mad Man</Name> <Effect> <Bonus>Strength</Bonus> <Alignment>3</Alignment> <Target>1</Target> </Effect> </Art> <Art> <ID>#5496851255</ID> <Name>Dismember</Name> <Effect> <Bonus>Speed</Bonus> <Alignment>6</Alignment> <Target>2</Target> </Effect> </Art> </Weapon> </Weapons> Then with this i should just be able to Delete the Node which would be about the same as with a SQL DB right well minus all the xpath stuff i have to learn i suppose The weapon System for my game is pretty complex gem+hilt+blade+art+stats+info=weapon Quote Link to comment Share on other sites More sharing options...
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.