svn-gvsig-desktop / trunk / libraries / libRemoteServices / src / org / gvsig / remoteClient / gml / schemas / XMLSimpleType.java @ 8017
History | View | Annotate | Download (3.36 KB)
1 |
package org.gvsig.remoteClient.gml.schemas; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import org.gvsig.remoteClient.gml.GMLException; |
6 |
import org.gvsig.remoteClient.utils.CapabilitiesTags; |
7 |
import org.kxml2.io.KXmlParser; |
8 |
import org.xmlpull.v1.XmlPullParserException; |
9 |
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
11 |
*
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
13 |
*
|
14 |
* This program is free software; you can redistribute it and/or
|
15 |
* modify it under the terms of the GNU General Public License
|
16 |
* as published by the Free Software Foundation; either version 2
|
17 |
* of the License, or (at your option) any later version.
|
18 |
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
27 |
*
|
28 |
* For more information, contact:
|
29 |
*
|
30 |
* Generalitat Valenciana
|
31 |
* Conselleria d'Infraestructures i Transport
|
32 |
* Av. Blasco Ib??ez, 50
|
33 |
* 46010 VALENCIA
|
34 |
* SPAIN
|
35 |
*
|
36 |
* +34 963862235
|
37 |
* gvsig@gva.es
|
38 |
* www.gvsig.gva.es
|
39 |
*
|
40 |
* or
|
41 |
*
|
42 |
* IVER T.I. S.A
|
43 |
* Salamanca 50
|
44 |
* 46005 Valencia
|
45 |
* Spain
|
46 |
*
|
47 |
* +34 963163400
|
48 |
* dac@iver.es
|
49 |
*/
|
50 |
/* CVS MESSAGES:
|
51 |
*
|
52 |
* $Id: XMLSimpleType.java 8017 2006-10-10 12:52:28Z jorpiell $
|
53 |
* $Log$
|
54 |
* Revision 1.4 2006-10-10 12:52:28 jorpiell
|
55 |
* Soporte para features complejas.
|
56 |
*
|
57 |
* Revision 1.3 2006/10/02 08:33:49 jorpiell
|
58 |
* Cambios del 10 copiados al head
|
59 |
*
|
60 |
* Revision 1.1.2.1 2006/09/19 12:23:15 jorpiell
|
61 |
* Ya no se depende de geotools
|
62 |
*
|
63 |
* Revision 1.2 2006/09/18 12:08:55 jorpiell
|
64 |
* Se han hecho algunas modificaciones que necesitaba el WFS
|
65 |
*
|
66 |
* Revision 1.1 2006/08/10 12:00:49 jorpiell
|
67 |
* Primer commit del driver de Gml
|
68 |
*
|
69 |
*
|
70 |
*/
|
71 |
/**
|
72 |
* A XS simple data type.
|
73 |
*
|
74 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
75 |
*/
|
76 |
public class XMLSimpleType implements IXMLType{ |
77 |
public static final String STRING = "XS:STRING"; |
78 |
public static final String INTEGER = "XS:INTEGER"; |
79 |
public static final String DOUBLE = "XS:DOUBLE"; |
80 |
public static final String FLOAT = "XS:FLOAT"; |
81 |
public static final String BOOLEAN = "XS:BOOLEAN"; |
82 |
public static final String LONG = "XS:LONG"; |
83 |
public static final String INT = "XS:INT"; |
84 |
|
85 |
private String type = null; |
86 |
|
87 |
|
88 |
|
89 |
public XMLSimpleType(String type) { |
90 |
super();
|
91 |
this.type = type;
|
92 |
} |
93 |
|
94 |
/*
|
95 |
* (non-Javadoc)
|
96 |
* @see org.gvsig.remoteClient.gml.IXMLType#getName()
|
97 |
*/
|
98 |
public String getName() { |
99 |
return type;
|
100 |
} |
101 |
|
102 |
/*
|
103 |
* (non-Javadoc)
|
104 |
* @see org.gvsig.remoteClient.gml.IXMLType#getType()
|
105 |
*/
|
106 |
public int getType() { |
107 |
return IXMLType.SIMPLE;
|
108 |
} |
109 |
|
110 |
/**
|
111 |
* @param type The type to set.
|
112 |
*/
|
113 |
public void setType(String type) { |
114 |
this.type = type;
|
115 |
} |
116 |
|
117 |
public Object getObject(String value)throws GMLException{ |
118 |
try{
|
119 |
if (type.equals(STRING)){
|
120 |
return value;
|
121 |
}else if (type.equals(INTEGER)){ |
122 |
return new Integer(value); |
123 |
}else if (type.equals(DOUBLE)){ |
124 |
return new Double(value); |
125 |
}else if (type.equals(FLOAT)){ |
126 |
return new Float(value); |
127 |
}else if (type.equals(BOOLEAN)){ |
128 |
return new Boolean(value); |
129 |
} |
130 |
}catch (Exception e){ |
131 |
throw new GMLException(GMLException.EXC_ATTRIB_WITH_INVALID_FORMAT); |
132 |
} |
133 |
return value;
|
134 |
} |
135 |
|
136 |
|
137 |
} |