Statistics
| Revision:

root / trunk / libraries / libGPE-GML / src / GPEGmlParser.java @ 11239

History | View | Annotate | Download (3.48 KB)

1
import java.io.File;
2
import java.io.FileInputStream;
3
import java.io.FileNotFoundException;
4
import java.io.IOException;
5
import java.io.InputStream;
6

    
7
import org.gvsig.gpe.GPEContentHandler;
8
import org.gvsig.gpe.GPEErrorHandler;
9
import org.gvsig.gpe.gml.writer.GPEGmlWriterHandler;
10
import org.gvsig.gpe.writers.GPEWriterHandler;
11
import org.gvsig.gpe.xml.GPEXmlParser;
12
import org.xmlpull.v1.XmlPullParserException;
13

    
14
import com.sun.xml.xsom.parser.XSOMParser;
15

    
16
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
17
 *
18
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
19
 *
20
 * This program is free software; you can redistribute it and/or
21
 * modify it under the terms of the GNU General Public License
22
 * as published by the Free Software Foundation; either version 2
23
 * of the License, or (at your option) any later version.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program; if not, write to the Free Software
32
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
33
 *
34
 * For more information, contact:
35
 *
36
 *  Generalitat Valenciana
37
 *   Conselleria d'Infraestructures i Transport
38
 *   Av. Blasco Ib??ez, 50
39
 *   46010 VALENCIA
40
 *   SPAIN
41
 *
42
 *      +34 963862235
43
 *   gvsig@gva.es
44
 *      www.gvsig.gva.es
45
 *
46
 *    or
47
 *
48
 *   IVER T.I. S.A
49
 *   Salamanca 50
50
 *   46005 Valencia
51
 *   Spain
52
 *
53
 *   +34 963163400
54
 *   dac@iver.es
55
 */
56
/* CVS MESSAGES:
57
 *
58
 * $Id: GPEGmlParser.java 11239 2007-04-18 12:54:45Z csanchez $
59
 * $Log$
60
 * Revision 1.1  2007-04-18 12:54:45  csanchez
61
 * Actualizacion protoripo libGPE
62
 *
63
 *
64
 */
65
/**
66
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
67
 */
68
public class GPEGmlParser extends GPEXmlParser{
69

    
70
        private XSOMParser SchemaParser = null;
71
        
72
        public GPEGmlParser(GPEContentHandler contents, GPEErrorHandler errors) {
73
                super(contents, errors);
74
                // TODO Ap?ndice de constructor generado autom?ticamente
75
        }
76
        
77
        /*
78
         * (non-Javadoc)
79
         * @see org.gvsig.gpe.GPEParser#getFormats()
80
         */
81
        public String[] getFormats() {
82
                String[] formats = new String[2];
83
                formats[0] = "GML";
84
                formats[1] = "XML";
85
                return formats;
86
        }
87

    
88
//        /*
89
//         * (non-Javadoc)
90
//         * @see org.gvsig.gpe.GPEParser#getWriter(java.lang.String, java.lang.String)
91
//         */
92
//         public IGPEContentHandler getHandler(String format, File file) throws IOException {
93
//                return new GPEContentHandler(format,file);
94
//        }
95

    
96
        /** 
97
         * 
98
         * AQUI SE IMPLEMENTA LA BASE PARA PODER PARSEAR CUALQUIER FICHERO GML:
99
         * -COMPROBAR SI EXISTE
100
         * -COMPROBAR CODIFICACI?N DEL XML
101
         * -ABRIR EN MODO LECTURA CON LA CODIFICACI?N CORRECTA
102
         * -CREAR EL PARSER DE XML ?"XSOM"?
103
         * -DETECTAR FORMATO FICHERO Y VERSI?N ?"EST? REGISTRADO"?
104
         * -SI EXISTE, LLAMADA AL PARSER DEL FORMATO CONCRETO
105
         *
106
         **/
107
        
108
        public boolean accept(File file) {
109
                if ((file.getName().toUpperCase().endsWith("GML"))
110
                                || (file.getName().toUpperCase().endsWith("XML"))) {
111
                        return true;
112
                }
113
                return false;
114
        }
115

    
116
        protected InputStream createInputStream(File file) throws FileNotFoundException {
117
                // TODO Ap?ndice de m?todo generado autom?ticamente
118
                return new FileInputStream(file);
119
        }
120

    
121
        protected void initParse() {
122
                
123
        }
124
        /*
125
         * (non-Javadoc)
126
         * @see org.gvsig.gpe.GPEParser#getWriter(java.lang.String)
127
         */
128
        public GPEWriterHandler getWriter(String format) {
129
                return new GPEGmlWriterHandler(format, getErrorHandler());
130
        }
131

    
132
}