Page 1 of 1

XML parser/xmlfile component

Posted: Wed Sep 12, 2012 3:32 am
by darkhog
How about component that would let us store game's config or other data in convenient XML format, so in case user would set wrong settings that would render game unusable he/she could edit convenient xml file.

Or maybe I am missing something and there's already way to read/write .XMLs from within game?

Posted: Wed Sep 12, 2012 10:27 am
by Rado1
You can read/write any file format with File component, including XML. Of course you must write code for loading and saving XML files having application-specific schema. This is not a big problem, because more effort is not put to "wrapping" data to XML format, but mapping of the imported/exported data to/from data holders in your application (variables, properties of components and their instances).

Having a generic XML parser in ZGE would be more complicated - for instance, for a given structure (schema/DTD) of XML file you need to specify actions applied when some tag, attribute or content was parsed, also you need to specify generation of tags based on runtime configuration of your application and included objects, etc. Even if a generic XML parser would help, specifying these actions/mapping can be complicated.

I'm skeptic about usage XML for storing application configuration and I personally prefer proprietary application-specific configuration files. Is there any strong argument for XML?

Posted: Wed Sep 12, 2012 10:28 am
by Kjell
Hi darkhog,

I wrote a INI library for ZGameEditor a couple of years ago. You might want to take a look / use that :wink:

K