0

I am sending requests to webservice and receive XML results that I convert to Java object. Now that I want to show this results to my application users, I need to show them in a specific XML format. I know that I can iterate through the object that I created from received XML to retrieve the values and put them in my new object and convert that to the desirable xml.

Just wondering if there is any better approach to do it?

  1. Client sends request to webservice
  2. Webservice returns xml response
  3. Client need to convert the received xml response into its desirable xml format

1 Answer 1

1

If you haven't heard of XSLT yet, it is the easiest way to transform XML from one format to any other XML format. I think this is the best and simplest way of doing what you need.

Sign up to request clarification or add additional context in comments.

3 Comments

Yeah XSLT is the way to go here. It is simple and effective.
how about if I have multiple xmls and need to show them all? or if the received response is in JSON? does that make any difference?
The run multiple XSLT transformations. You haven't mentioned anything about JSON, that would be the other story then. Of course you could covert JSON to XML and then run transformation but not sure if its worth doing, all depends on your requirements.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.