We have a case scenario in our project where we are provided with a set of XSDs. These XSDs we converted to Java Pojos with the help of JAXB. After this we were suppose to update few values in the Pojo and converted back into the corresponding XML file. The number of XSD provided to us is large, they are similar - but placement of XML tags differ e.g. same tag will be present in different elements in different XSDs. Thus in for updating any element we had to write different methods so that it returns the specific XML. Is there any way or design change by which we may kind off generalize the updation part.
Asked
Active
Viewed 55 times
1
-
JAXB has the option use super classes. You would implement common behavior in your super-class. – BobDalgleish Jan 30 '20 at 18:04
-
If set of XSDs has been provided, could suppose its a part of some external API or designed data model. Are your sure that any kind of change in these XSDs will not break compatibility or technical specs? – Alex Chernyshev Feb 05 '20 at 02:04
-
We are not provided with the access for changing or modifying the XSD. – Sri9911 Feb 05 '20 at 17:19
-
If so then better not to alter POJOs classes directly, consider them as part of external API. And to solve 'design change by which we may kind off generalize the updation part' you'll need to create such 'generalization' logic on top of these POJOs, like a special service that does updating in multiple POJOs at once. – Alex Chernyshev Feb 09 '20 at 09:08