xml files external files and such

BlitzMax Forums/BlitzMax Programming/xml files external files and such

Cruis.In(Posted 2013) [#1]
Hey guys I have searched but not found any kind of xml tutorial.

Basically I want to store game dialogue in a file other than a .bmx :)
could get pretty big pretty fast!

Are there guides on how to go about this? Do you have to write any specific code in the xml file or file you are writing/retrieving from?


Brucey(Posted 2013) [#2]
Xml is fun :-)

Although some people will tell you it is much too verbose/bloaty/fat and you should instead create your own load/save binary stuff instead.

For game dialogue you probably don't need to make your xml too complex. You just need an idea of what you want to store, exactly :
<?xml version="1.0"?>
<dialogue>
    <text id="1">Hello</text>
</dialogue>


I assume you know a little about XML? If not, google some examples. There are more than you can possibly imagine.

There are different ways to load xml.
* You can do it by hand - writing your own parser.
* You can use one of the third-party xml modules. I have two (expat and libxml). There are others.

The modules usually come with some small examples to give you an idea what to do next.


Cruis.In(Posted 2013) [#3]
ok thanks brucey that is exactly what I needed to know. Like what the contents of the xml file should look like, and I guess I'll be able to follow the examples of how to properly code the file to get what I want displayed or READ from the file in game.

I can't write a parser since I have no software engineering experience, in another life I'd come back as a programmer, but in this one my professional career won't lend to me specializing in something that requires equal dedication :)

I will use your module. My needs are simple. Store my dialogue and read from it for the dialogue sequences.


thanks again.


xlsior(Posted 2013) [#4]
There are already some free XML parsers in the code archives, not much coding required.

the nice thing about XML is that it makes it easy to keep things hierarchical, and you can easily add additional information to your files that won't be in the way of your existing stuff.

also makes it easy to for example add multiple languages and such, since you can just through another tag around the relevant information

Last edited 2013


GfK(Posted 2013) [#5]
I use bruceys libxml module.


dynaman(Posted 2013) [#6]
> Although some people will tell you it is much too verbose/bloaty/fat and you should instead create your own load/save binary stuff instead.

Let me be the first! It *IS* too bloaty/FAT/Verbose.

But it you have a predefined module for using it then go ahead. (and since there are free xml parses that is covered).