I am using angularjs and spring mvc in my application. angularjs invokes spring controller using rest. The controller invokes external URL that returns XML.
Now, I want to send this XML to angularjs in json format. I can convert the xml into java objects (using jaxb) and use jackson-databind jar to convert java into json. However, the xml structure returned from the external URL is dynamic and can change any time that is not under my control. In this scenario, if the xml structure changes, I will have to modify my java object. This is tedious.
Rather, if I can send the xml response directly to angularjs in the form of json, it will make my task easier.
Is there any way to achieve this?
Alternatively, can I invoke the external URL directly in angularjs? Will the returned xml be converted to json automatically? Or should I be using any component or JS library to convert it into json?