This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi everyone, my client should create the XML files and save it on the hard drive. As the information that should be written in the XML file is on the server, my server (one EJB) will perform the XML- creation operation. I am planning to use JDOM for XML creation. After the xml object is created the server returns it to the client.
My question is: What type (String, org.jdom.Document, OutputStream or etc.) is the better to use for transfer the XML object from the server to client? Thanks a lot for your help!
it mostly depends on your design to wether generate the XML on the server or in the client. if you generate XML on the server you introduce some loads on your server depend on how much sophesticated is your XML generation.
if you generate xml on clients you may have un-ceneteralized buziness logic , incase that you change something in the server that affect the xml generation you must update all clients.
I would use StringBuffer to create the xml , as it sounds your xml is not such sophisticated , using an string buffer (imho) is much speedier than using DOM to create XML.
you can transfer the xml content to client (in case that you generate it in server) in a simplest possible objet , as simpler your object is your serialization will be simpler and faster.