KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > cheatsheets > data > ParserInput


1 /*******************************************************************************
2  * Copyright (c) 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
12 package org.eclipse.ui.internal.cheatsheets.data;
13
14 import java.net.MalformedURLException JavaDoc;
15 import java.net.URL JavaDoc;
16
17 /**
18  * The input to the parser which can be the URL of a file
19  * or a string of XML
20  */

21
22 public class ParserInput {
23     private URL JavaDoc url;
24     private String JavaDoc xml;
25     private String JavaDoc pluginId;
26     
27     public ParserInput() {
28         url = null;
29         xml = null;
30     }
31     
32     public ParserInput(String JavaDoc xml, String JavaDoc basePath) {
33         this.xml = xml;
34         this.url = null;
35         if (basePath != null) {
36             try {
37                 this.url = new URL JavaDoc(basePath);
38             } catch (MalformedURLException JavaDoc e) {
39                 // leave the url null
40
}
41         }
42     }
43     
44     public ParserInput(URL JavaDoc url, String JavaDoc pluginId) {
45         this.url = url;
46         this.xml = null;
47         this.pluginId = pluginId;
48     }
49     
50     public URL JavaDoc getUrl() {
51         return url;
52     }
53     
54     public String JavaDoc getXml() {
55         return xml;
56     }
57
58     public String JavaDoc getPluginId() {
59         return pluginId;
60     }
61
62 }
63
Popular Tags