Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

editing xml and zip the file

 
Veeresh kal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a zip file xxxx.zip which have one xml xxx.xml file and another zip aaaa.zip file as an attachment. I need to extract the xxxx.zip and I need to replace one of the string in xml and again I need to zip the xxx.xml and aaaa.zip back to xxxx.zip. Can any one suggest how I can go about.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

See here for some examples of how to work with ZIP files in Java code: http://www.exampledepot.com/egs/java.util.zip/pkg.html

How complex is the XML change? If it's just text replacement, you may be able to do it with string operations, but if it involves structural changes you should use one of the available XML APIs (DOM or SAX).

Since the question has nothing to do with servlets -which this forum is all about- I'll move it to a more appropriate forum.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic