Has someone experience with JAXB? And do you use Java 1.6?

I use a lot of XML (for maps, settings, vocabulary etc) in my game. I develop in Java 1.5.0, so JAXB is not available and I use a lot of clumsy SAX code. So I have some questions:

  • do you think JAXB is MUCH easier to work with? (I read through the tutorial, but it's hard to tell from this)
  • if I decide to use JAXB, it's better to bundle the lib or to go to Java 1.6 (which already contains it)?
  • for the "lib" solution: are there any problems with the licenses? (I use GNU GPL2)
  • Are your users complaining if you use Java 1.6 instead of 1.5?



    Of course there are other things that make Java 1.6 interesting (e.g. the scripting API), but I have no idea how many (non-nerd) people already installed it, and if people would be willing to download 80MB+ just to play a little game. On the other hand it will take some month to get the "final release", so probably more people have Java 1.6…



    Thanks for every hint…

Well, personally I wouldn't touch JAXB for game development…XML in general for game development is bad for anything more than basic settings I believe.  XML takes significantly longer to load and if you use the DOM then it wastes a lot more memory.  You're better dealing with serialized files or some sort of binary format in my opinion.

if you have to use xml, you might want to take a look at XStream.

sfera, this looks very promising, thanks for the hint!



A little explanation about my game: I don't use XML for any geometry data. My maps are a kind of "tiled" maps, and the available pieces are predefined. The vocabulary data are also XML, because I need a little bit more structure than key-value pairs. I have not much game settings now, but I want to include key maps etc, so I probably stay with XML for this. Users should be able to write or edit content, so binary formats are not so useful.


xstream is quite fast if you use xpp as parser. but first you might want to take a look at the xpp license.

imho java Properties are enough for the settings.

You can easily use xml, and not care about the speed, as long as you make sure you can cache the right things to jme's binary format by having your game objects implement the Savable interface.



If you're building an "open" game, of course XML is a very good choice.

llama said:

If you're building an "open" game, of course XML is a very good choice.


if you mean open like in allowing users to extend it and add/modify content, i agree. in my project (if it can stiil be called that way) i'm using xml for saving the scene description(i don't save the whole scene as binary, but rather describe which models to use, where to place and how it looks like), texture name mapping, user configurations, and some game data. i'm not sure yet if it will stay this way and maybe i will move to a binary format later, but it's certainly much easier to develop using xml. i can change how a scene looks like by just editing the xml file.

@sfera: my game works similar.



@all: thanks for the response