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.

  • JAXB has the option use super classes. You would implement common behavior in your super-class. Jan 30, 2020 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? Feb 5, 2020 at 2:04
  • We are not provided with the access for changing or modifying the XSD.
    – Sri9911
    Feb 5, 2020 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. Feb 9, 2020 at 9:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.