I have several XML config files which are regularly modified and reread using JAXB (Java) by my program and are necessary for it to work however third party apps may also edit and create these files so to allow updating of my software after distribution I want to be able to recognise files missing elements and provide defaults.
Is there any good way to do this, at the moment the best I can come up with is to set that all the fields that can be given defaults to minOccurs="0" then check for nulls on every field on import but as my files are quite complex this seems horribly inefficient. Is there some kind of default value option in the XSD files I construct the classes from to add the elements in with default values... there seems to be a default to replace blank fields with a default but I want to actually add any missing fields not just populate the empty fields.
Any pointers or advice would be appreciated.