File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes editing xml and zip the file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "editing xml and zip the file" Watch "editing xml and zip the file" New topic

editing xml and zip the file

Veeresh kal

Joined: Oct 12, 2009
Posts: 1
I have a zip file which have one xml xxx.xml file and another zip file as an attachment. I need to extract the and I need to replace one of the string in xml and again I need to zip the xxx.xml and back to Can any one suggest how I can go about.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Welcome to JavaRanch.

See here for some examples of how to work with ZIP files in Java code:

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.
I agree. Here's the link:
subject: editing xml and zip the file
jQuery in Action, 3rd edition