Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libGPE-GML / src / org / gvsig / gpe / xml / GPEXmlParserFactory.java @ 12071

History | View | Annotate | Download (2.59 KB)

1
package org.gvsig.gpe.xml;
2

    
3
import java.lang.reflect.InvocationTargetException;
4

    
5
import org.xmlpull.v1.XmlPullParser;
6

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

    
89
        /**
90
         * @param parser the parser to set
91
         */
92
        public static void registerParser(String className) {
93
                GPEXmlParserFactory.className = className;
94
        }
95
        
96
        
97
}