Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to extract an xml file after matching content from a zip file using java

 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am having a zip file with lot of xml files. I will be having some data in an excel sheet which I have to check with the xml files content and which ever xml file content matches with that data I have to extract that file only and store that in a folder. That is each record in that excel file matches with one xml file in the zip file.

Guide me to achieve this.

Thanking you.

--raaja.g
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to extract and test each XML document from the zip file. There is no way around it.

However, if your matching criteria are simple enough, you could use SAX or StaX parsing to check each document, much faster than building a DOM and using XPath for instance.

I suggest the first step is learning how to extract character streams from the zip file.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic