If I have a student DTO with data set into a Student Object and I want to hit a webservices which accepts a XML then how would I convert the DTO to XML?
I have done it though mule transformer but in normal java/xml how it would be done and vice versa??
I don't know what you mean by "normal Java/XML". However, what you would do first would be to examine the contents of the DTO, and examine the requirements for the content of the XML. Then you would determine the rules for mapping the DTO data items into the XML nodes. Only after all that would you decide how you were going to do the conversion.
Joined: Jul 08, 2011
The resp getters and setters are a part of class
I want the XML as
Personally, when I need to do something like this I just write a: either a toXML() method returning a String or a writeXML( Writer out ) method writing to a character stream in the class in question - Student in this case.
Write the opening tag lines, iterate through your collection writing the individual objects and then write a closing tag - Done!
Simpler, and I guarantee faster than any toolkit.
Remember, XML is just text with a few simple rules.