Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #5663
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad!not-for-mail |
|---|---|
| From | lbrt chx _ gemale kom |
| Newsgroups | comp.lang.java.programmer |
| Subject | trying to feed a zip file containing an XML one to a SAX parser ... |
| X-Newsreader | NetComponents |
| Organization | Acecape, Inc. |
| Organization | Newshosting.com - Highest quality at a great price! www.newshosting.com |
| X-Complaints-To | abuse(at)newshosting.com |
| Message-ID | <1308968121.989150@nntp.aceinnovative.com> (permalink) |
| Cache-Post-Path | nntp.aceinnovative.com!unknown@p70-44.acedsl.com |
| X-Cache | nntpcache 3.0.1 (see http://www.nntpcache.org/) |
| Date | 25 Jun 2011 02:15:22 GMT |
| Lines | 42 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5663 |
Show key headers only | View raw
~
the simple code below I use to feed an XMLReader with compressed ".bz2" and ".gz"
~
Since the zip file format is a container as well, I could imagine things are not that simple
~
How can you do the same (or a similar) thing with a zip file?
~
thanks
lbrtchx
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~
IFl = new File(aFlPth);
aFlPth = IFl.getCanonicalPath();
if(aFlPth.toLowerCase().endsWith(".gz")) {
BfrRdr = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(IFl)), "UTF-8"));
}
else if (aFlPth.toLowerCase().endsWith(".bz2")) {
BfrRdr = new BufferedReader(new InputStreamReader(new BZip2CompressorInputStream(new FileInputStream(IFl)), "UTF-8"));
}
else {
BfrRdr = new BufferedReader(new InputStreamReader(new FileInputStream(IFl), "UTF-8"));
}
// __
SAXParserFactory SAXFctry = SAXParserFactory.newInstance();
SAXFctry.setValidating(false);
SAXFctry.setNamespaceAware(true);
SchemaFactory SchmFctry = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
SAXParser SAXPrsr = SAXFctry.newSAXParser();
XMLRdr = SAXPrsr.getXMLReader();
// __ Register the content handler
XMLRdr.setContentHandler(new DefaultHandler2());
// __
lTm00 = System.currentTimeMillis();
XMLRdr.parse(new InputSource(BfrRdr));
System.err.println(TU.getElapsedTime(lTm00));
~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar
trying to feed a zip file containing an XML one to a SAX parser ... lbrt chx _ gemale kom - 2011-06-25 02:15 +0000 Re: trying to feed a zip file containing an XML one to a SAX parser ... Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-06-24 20:11 -0700 Re: trying to feed a zip file containing an XML one to a SAX parser ... Roedy Green <see_website@mindprod.com.invalid> - 2011-06-25 06:53 -0700
csiph-web