XML versus Plain text

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

XML versus Plain text

Post by BlindSide »

What is the advantage of using XML to store config etc vs plaintext considering overhead, etc. I heard its pointless to use XML for small things.
AaronA
Posts: 55
Joined: Tue Sep 12, 2006 1:31 am

Post by AaronA »

XML is really more of an object-oriented aproach. Seeing as its a database it is somewhat pointless for small things that you could use other means of tracking, but others might disagree. It doesn't really matter in the end what database system you choose (XML, Plaintext, etc), as long as it writes and loads variables.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

in contrast to INI files or other plain text-
arrays and hierarchy are trivial,
it formats special characters so you don't need to worry about quotes etc,
it's readable by man and machine,
and it's the modern way to do things.

the main advantage for just using it to store a couple of simple values is that you don't have to write and test your own load and save code, so it's potentially quicker to write.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

On a personal level, I despise XML. I use INI formats for all my configs, you can find tons of free INI parsers around. It is however, convenient to use XML since irrXML is included in Irrlicht.

My reasons for hating XML is because of the way people have tried to overuse the technology over the past 5-6 years. People want to use it for everything...XML formatted network messages, realtime XML logging( I know, realtime and XML shouldn't be included in the same sentence ), the list goes on. And generally, use of XML for config files is gross over-use. As was mentioned by someone in this thread, XML is useful for defining heirarchy in text format, but aside from that, bleh, pointless IMO.
Image
Gladius_Coldhead
Posts: 56
Joined: Thu Oct 12, 2006 5:15 am

Post by Gladius_Coldhead »

I use in my item system...

Code: Select all

<?xml version="1.0"?>

<!-- Item System by Gladius Coldhead-->
<name name="Elixir Medicinal" />
<description description="Elixir usado para curar ferimentos e recuperar Vida" />
<id id="7" />
<!-- Weight in KG , float-->
<height Weight="1.3" />
<!-- use 'type list' -->
<type type="1034" />
<!-- model & texture in char* -->
<model model="itemmodels/elixir.obj" />
<texture texture="itemtextures/elixir.jpg" />
<triggerregion triggerregion="10" />
<value value="20" />
CGameItem test = new CGameItem("elixir.xml",2003);
obs: 2003 = item serial =/
messen
Posts: 25
Joined: Tue Aug 29, 2006 2:51 pm
Location: Agalon
Contact:

Post by messen »

Hi,
Gladius_Coldhead wrote:I use in my item system...

CGameItem test = new CGameItem("elixir.xml",2003);
obs: 2003 = item serial =/
Hmmm. I think this way is better IMO. You can store multiple item data in one file.

Code: Select all

<?xml version="1.0"?>

<!-- Item System by Gladius Coldhead-->
<items_list>
<item name="Elixir Medicinal" id="7" type="1034">
<description>
Elixir usado para curar ferimentos e recuperar Vida
</description>
<!-- Weight in KG , float-->
<height value="1.3" />
<!-- use 'type list' -->
<type value="1034" />
<!-- model & texture in char* -->
<model value="itemmodels/elixir.obj" />
<texture value="itemtextures/elixir.jpg" />
<triggerregion value="10" />
<value value="20" />
</item>
.
.
.
</items_list>
Post Reply