• 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

compress a xml file

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hi everyone,

Can anyone help me on compressing a xml file.

Can we programatically compress a xml file in java.

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure. XML is text, which should compress nicely using zip or gzip (both of which are implemented as part of the java.util.zip package). See http://www.exampledepot.com/egs/java.util.zip/pkg.html for some examples.
 
srikanth Thandra
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thankx for your suggestion, but i have another query..

For general text files comprerssing we use java.util.zip package.

But I want to compress a xml file which is sending as a file attachment.

Actually i am working on webservices.Client sends a request to my webservice in xml format file, i am attaching that file using SOAP and sending to the service.

So now what my question is can we compress that webservice request xml based file and then send it as an attachment.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's no problem to send any file (compressed or not) through a WS. See Transferring files over a web service and Sending SOAP attachments using SAAJ.
 
srikanth Thandra
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

thankx for your suggestions and replies.

I have referred to your given information and done successfully sending a request to the service as a attachment.

I have a query now.... After requesting i am able to generate a response for the given request. I am storing the response as a xml file in a particular location(i.e in file system).Now I want to send that response xml file to the client as an attachment.

But it is not working well. It doesn't even showing any exception like FileNotFoundException,unable to read the xml content.

I stucked here to proceed further. Do you have any code for sending the response as an attachment from the webservice to client.
 
reply
    Bookmark Topic Watch Topic
  • New Topic