Because of increasing configuration complexity, I want to introduce XML for my library’s configuration files, and replace the existing properties files.
I would like to
- Publicly describe the XML structure with XSD (so the structure is documented and can be versioned)
- If possible, generate Java source code from that XSD for unmarshalling (like with JAXB / XJC). An alternative simple access method is OK too (e.g. simple XPath expressions)
- Have a low footprint and few or even none additional dependencies
If the footprint wasn’t an issue, I’d choose JAXB right away. Are there similar libraries with a lower footprint?
EDIT: By footprint, I don’t mean consumed memory but the “size” of the library in KB/number of classes. I’d expect my rather simple use-case to be coverable by a library with about 5-6 classes. I don’t need the full power of JAXB.
For a zero-dependency solution use the DOM or the SAX parser that is part of every Java VM.
If you want Java type binding, stick with JAXB. Even if you find a smaller size library, you will loose out by using a non-standard solution that hasn’t been as extensively tested or has as many developers who know how to use it.