KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > builders > DefaultSAXParser


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.core.builders;
12
13 import java.io.BufferedInputStream JavaDoc;
14 import java.io.IOException JavaDoc;
15 import java.io.InputStream JavaDoc;
16
17 import javax.xml.parsers.ParserConfigurationException JavaDoc;
18
19 import org.eclipse.core.resources.IFile;
20 import org.eclipse.core.runtime.CoreException;
21 import org.eclipse.pde.internal.core.util.SAXParserWrapper;
22 import org.xml.sax.SAXException JavaDoc;
23
24 public class DefaultSAXParser {
25     
26     public static void parse(IFile file, XMLErrorReporter reporter) {
27         InputStream JavaDoc stream = null;
28         SAXParserWrapper parser = null;
29         try {
30             parser = new SAXParserWrapper();
31             stream = new BufferedInputStream JavaDoc(file.getContents());
32             parser.parse(stream, reporter);
33         } catch (CoreException e) {
34         } catch (SAXException JavaDoc e) {
35         } catch (IOException JavaDoc e) {
36         } catch (ParserConfigurationException JavaDoc e) {
37         } finally {
38             try {
39                 if (stream != null)
40                     stream.close();
41             } catch (IOException JavaDoc e1) {
42             }
43         }
44     }
45     
46 }
47
Popular Tags