Statistics
| Revision:

root / trunk / libraries / libGPE-GML / src / org / gvsig / gpe / xml / GPEXmlParserFactory.java @ 11158

History | View | Annotate | Download (2.5 KB)

1
package org.gvsig.gpe.xml;
2

    
3
import java.lang.reflect.InvocationTargetException;
4

    
5
import org.gvsig.gpe.GPEParser;
6
import org.kxml2.io.KXmlParser;
7
import org.xmlpull.v1.XmlPullParser;
8

    
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id: GPEXmlParserFactory.java 11158 2007-04-12 10:23:41Z jorpiell $
52
 * $Log$
53
 * Revision 1.1  2007-04-12 10:23:41  jorpiell
54
 * Add some writers and the GPEXml parser
55
 *
56
 *
57
 */
58
/**
59
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
60
 */
61
public class GPEXmlParserFactory {
62
        private static String className = null;
63
        
64
        /**
65
         * @return the parser
66
         * @throws NoSuchMethodException 
67
         * @throws InvocationTargetException 
68
         * @throws IllegalAccessException 
69
         * @throws InstantiationException 
70
         * @throws SecurityException 
71
         * @throws IllegalArgumentException 
72
         * @throws ClassNotFoundException 
73
         */
74
        public static XmlPullParser getParser() throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
75
                if (className==null){
76
                        className = "org.kxml2.io.KXmlParse";
77
                }
78
                Class clazz = Class.forName(className);
79
                if (clazz != null){
80
                        return (XmlPullParser)clazz.getConstructor(null).newInstance(null);
81
                }
82
                return null;
83
        }
84

    
85
        /**
86
         * @param parser the parser to set
87
         */
88
        public static void registerParser(String className) {
89
                GPEXmlParserFactory.className = className;
90
        }
91
        
92
        
93
}