Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / kml / KmlHeaderParser.java @ 10269

History | View | Annotate | Download (2.4 KB)

1
package org.gvsig.remoteClient.kml;
2

    
3
import org.gvsig.remoteClient.gml.engine.readers.IReaderFile;
4
import org.gvsig.remoteClient.kml.exceptions.KmlHeaderParseException;
5
import org.gvsig.remoteClient.kml.exceptions.KmlNotRootTagException;
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: KmlHeaderParser.java 10269 2007-02-12 13:51:08Z jorpiell $
50
 * $Log$
51
 * Revision 1.1  2007-02-12 13:49:18  jorpiell
52
 * A?adido el driver de KML
53
 *
54
 *
55
 */
56
/**
57
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
58
 */
59
public class KmlHeaderParser {
60
        private IReaderFile reader = null;
61
        private String nameSpace = null;                
62
        
63
        public KmlHeaderParser(IReaderFile reader) throws KmlHeaderParseException{
64
                this.reader = reader;
65
                parseHeader();
66
        }
67
        
68
        /**
69
         * This method parses the kml header file
70
         * @throws KmlHeaderParseException
71
         */
72
        private void parseHeader() throws KmlHeaderParseException{
73
                try {
74
                        reader.nextTag();
75
                        String name = reader.getName();
76
                        if (name.compareTo(KmlTags.ROOT) != 0){
77
                                throw new KmlNotRootTagException(name);
78
                        }
79
                        for (int i=0 ; i<reader.getAttributeCount() ; i++){
80
                                nameSpace = reader.getAttributeValue(i);                                
81
                        }
82
                } catch (Exception e) {
83
                        throw new KmlHeaderParseException(e);
84
                } 
85
        }
86

    
87
        /**
88
         * @return Returns the nameSpace.
89
         */
90
        public String getNameSpace() {
91
                return nameSpace;
92
        }
93
}