Creating equivalent output with jaxb



I'm doing a project for a customer where i have to read XML files, analyse them, do some corrections when needed and write them out again. I used JAXB to solve this, just unmarshalling the file, working with the resulting objects and marshalling the objects back to files when finished.


Sadly my customer has the requirement that the XML files should not be changed, except the parts intentionally changed by my program. This causes trouble because JAXB changes XML files when marshalling, for example by changing the order of attributes or by moving the definition of a namespace up to the root element of the XML structure.


Do i have any possibilities to change the output of the JAXB marshaller to match the expectations of my customer? Or if this is not achievable with JAXB, are there any alternative XML libraries for Java which can preserve the XML files as much as possible? I am currently trying to use DOM and SAX for this, but it seems like a big hassle to get them to work like i want to...


No comments:

Post a Comment