• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Transfer XML object from server to client

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am confused. If the data that goes into the XML file is on the server side, why doesn't the Server side create the XML File?

I don't think the different types of return type makes much of a difference. You could create the File on the server and send that over. The difference of any of the types is kind of really small.

Mark
 
Elena Taube
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,

Thanks a lot for your fast answer.
The xml file should be saved (on hard drive) on the client. That is my problem.

But I�m not sure, if it is a good idea to generate XML on the server.

1. XML file generate on the client.
The client receives the information from the server and use it for the XML generation.

2.XML file generate on the server.
The server generate XML and transfer it to the client as one object. But what object can I use to transfer?

I�m not sure if the using of the JDOM is a good idea. I am thinking about to create it with StringBuffer or with java.io.Writer.
How do you think about it?
Thank a lot!
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
My, my, aren't you a big fella. Here, have a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic