Solved

SAX Parse Zip File

Posted on 2012-04-12
1
452 Views
Last Modified: 2012-04-18
Hi experts,

I am working on a project that needs to use SAX to parse an xml zip file ("myZip.zip"). The file is so big that I have to use SAX instead of DOM.

Does anybody have a basic piece of Java code to share with me so that I can start? This is my first time to work on such a SAX-parse-xmlzip project so any help is greatly appreciated.

Thanks so much.
0
Comment
Question by:davidw88
1 Comment
 
LVL 35

Accepted Solution

by:
mccarl earned 400 total points
ID: 37841147
Something along the lines of...

XMLReader xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setContentHandler(new MyHandler());
xmlReader.parse(new InputSource(new ZipInputStream(new FileInputStream("myZip.zip"))));

Open in new window


And then the main task is to implement a ContentHandler class (MyHandler in the above) to do the actual parsing work.



As you can see it's pretty simple, so I guess that you may have other questions. If you can be more explicit about what you are having troubles with, I can help you better.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Article by: Nadia
Linear search (searching each index in an array one by one) works almost everywhere but it is not optimal in many cases. Let's assume, we have a book which has 42949672960 pages. We also have a table of contents. Now we want to read the content on p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now