Backend system accepts the request in xml format and returns a complex response xml.
Request Xml and Response Xml is generic and has multiple layers. Xml elements do not have one to one mapping with UI fields. Xml contains a lot of metadata(id etc) and layers.
This is the reason I came up with Model xmls which are flat and have one to one mapping with UI fields.
I have following approaches to render data on UI:
- UI -> JSON ->ModelXml -> Request Xml/ In case of Response XML, reverse flow
a. JSON -> ModelXML transformation using some api
b. ModelXML -> RequestXml using XSLT - UI -> JSON ->RequestXML/ In case of Response XML, reverse flow
This will be one to one mapping and whenever there is a change on the UI, someone needs to take care of JSON->RequestXML transformation.
Note: UI layout is configurable. Here I am talking 200+ data entry forms.
So the question which one is a better approach in terms for less development time, performance and maintainability?
Is it possible to do JSON <-> XML with XSLT?
For example:
**Xml Structure**
<RequestXml>
<Paramateres>
<Metadata></Metadata>
</Paramateres>
<Party>
<State></State>
<Person>
<FirstName></FirstName>
<LastName></LastName>
</Person>
<Address type="Residence">
<Line1>28 North Main Street</Line1>
<City>Alberta</City>
</Address>
<SSN></SSN>
</Party>
</RequestXml>
JSON
"ClientInformation":{"FirstName":"Name", "LastName":"Yadav","Line1":"28 North Main Street","City":"Alberta","State":"", "SSN":""}