root / branches / v2_0_0_prep / libraries / libGPE-GML / src / org / gvsig / gpe / gml / utils / GMLUtilsParser.java @ 28113
History | View | Annotate | Download (4.65 KB)
1 |
package org.gvsig.gpe.gml.utils; |
---|---|
2 |
|
3 |
import javax.xml.namespace.QName; |
4 |
|
5 |
import org.gvsig.compat.CompatLocator; |
6 |
import org.gvsig.gpe.GPELocator; |
7 |
import org.gvsig.gpe.GPEManager; |
8 |
import org.gvsig.gpe.gml.GmlProperties; |
9 |
import org.gvsig.gpe.xml.XmlProperties; |
10 |
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
12 |
*
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
14 |
*
|
15 |
* This program is free software; you can redistribute it and/or
|
16 |
* modify it under the terms of the GNU General Public License
|
17 |
* as published by the Free Software Foundation; either version 2
|
18 |
* of the License, or (at your option) any later version.
|
19 |
*
|
20 |
* This program is distributed in the hope that it will be useful,
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
* GNU General Public License for more details.
|
24 |
*
|
25 |
* You should have received a copy of the GNU General Public License
|
26 |
* along with this program; if not, write to the Free Software
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
28 |
*
|
29 |
* For more information, contact:
|
30 |
*
|
31 |
* Generalitat Valenciana
|
32 |
* Conselleria d'Infraestructures i Transport
|
33 |
* Av. Blasco Ib??ez, 50
|
34 |
* 46010 VALENCIA
|
35 |
* SPAIN
|
36 |
*
|
37 |
* +34 963862235
|
38 |
* gvsig@gva.es
|
39 |
* www.gvsig.gva.es
|
40 |
*
|
41 |
* or
|
42 |
*
|
43 |
* IVER T.I. S.A
|
44 |
* Salamanca 50
|
45 |
* 46005 Valencia
|
46 |
* Spain
|
47 |
*
|
48 |
* +34 963163400
|
49 |
* dac@iver.es
|
50 |
*/
|
51 |
/* CVS MESSAGES:
|
52 |
*
|
53 |
* $Id: GMLUtilsParser.java 189 2007-11-21 12:45:56Z csanchez $
|
54 |
* $Log$
|
55 |
* Revision 1.8 2007/06/28 13:05:09 jorpiell
|
56 |
* The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class
|
57 |
*
|
58 |
* Revision 1.7 2007/05/18 10:41:01 csanchez
|
59 |
* Actualizaci?n libGPE-GML eliminaci?n de clases inecesarias
|
60 |
*
|
61 |
* Revision 1.6 2007/05/16 13:00:48 csanchez
|
62 |
* Actualizaci?n de libGPE-GML
|
63 |
*
|
64 |
* Revision 1.5 2007/05/16 09:29:12 jorpiell
|
65 |
* The polygons has to be closed
|
66 |
*
|
67 |
* Revision 1.4 2007/05/15 10:14:45 jorpiell
|
68 |
* The element and the feature is managed like a Stack
|
69 |
*
|
70 |
* Revision 1.3 2007/05/15 09:35:09 jorpiell
|
71 |
* the tag names cant have blanc spaces
|
72 |
*
|
73 |
* Revision 1.2 2007/05/07 12:58:42 jorpiell
|
74 |
* Add some methods to manage the multigeometries
|
75 |
*
|
76 |
* Revision 1.1 2007/02/28 11:48:31 csanchez
|
77 |
* *** empty log message ***
|
78 |
*
|
79 |
* Revision 1.1 2007/02/20 10:53:20 jorpiell
|
80 |
* A?adidos los proyectos de kml y gml antiguos
|
81 |
*
|
82 |
* Revision 1.3 2007/01/15 13:11:00 csanchez
|
83 |
* Sistema de Warnings y Excepciones adaptado a BasicException
|
84 |
*
|
85 |
* Revision 1.2 2006/12/22 11:25:44 csanchez
|
86 |
* Nuevo parser GML 2.x para gml's sin esquema
|
87 |
*
|
88 |
* Revision 1.1 2006/08/10 12:00:49 jorpiell
|
89 |
* Primer commit del driver de Gml
|
90 |
*
|
91 |
*
|
92 |
*/
|
93 |
/**
|
94 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
95 |
* @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
|
96 |
*/
|
97 |
public class GMLUtilsParser { |
98 |
private static GPEManager gpeManager = GPELocator.getGPEManager(); |
99 |
|
100 |
/**
|
101 |
* Remove the blanc symbol from a tag
|
102 |
* @param tag
|
103 |
* Tag name
|
104 |
* @return
|
105 |
* The tag without blancs
|
106 |
*/
|
107 |
public static String removeBlancSymbol(String tag){ |
108 |
if (tag == null){ |
109 |
return null; |
110 |
} |
111 |
String blancSpace = gpeManager.getStringProperty(XmlProperties.DEFAULT_BLANC_SPACE);
|
112 |
if (blancSpace == null){ |
113 |
blancSpace = GMLTags.GML_DEAFULT_BLANC_SPACE; |
114 |
} |
115 |
// PROBLEM WITH COMPATIBILITY OF "replaceAll()" WITH IBM J9 JAVA MICROEDITION
|
116 |
return CompatLocator.getStringUtils().replaceAll(tag, blancSpace, " "); |
117 |
//return StringUtils.replaceAllString(tag, blancSpace, " ");
|
118 |
// return tag.replaceAll(blancSpace," ");
|
119 |
} |
120 |
|
121 |
/**
|
122 |
* Replace the blancs of a tag with the
|
123 |
* deafult blanc symbol
|
124 |
* @param tag
|
125 |
* @return
|
126 |
* A tag with blancs
|
127 |
*/
|
128 |
public static String addBlancSymbol(String tag){ |
129 |
if (tag == null){ |
130 |
return null; |
131 |
} |
132 |
String blancSpace = gpeManager.getStringProperty(XmlProperties.DEFAULT_BLANC_SPACE);
|
133 |
if (blancSpace == null){ |
134 |
blancSpace = GMLTags.GML_DEAFULT_BLANC_SPACE; |
135 |
} |
136 |
return CompatLocator.getStringUtils().replaceAll(tag," ",blancSpace); |
137 |
} |
138 |
|
139 |
/**
|
140 |
* @return a default feature collection name
|
141 |
*/
|
142 |
public static QName createDefaultFeatureCollection(){ |
143 |
String namespace = gpeManager.getStringProperty(XmlProperties.DEFAULT_NAMESPACE_URI);
|
144 |
String localName = gpeManager.getStringProperty(GmlProperties.DEFAULT_FEATURECOLLECTION);
|
145 |
return new QName(namespace, localName); |
146 |
} |
147 |
|
148 |
/**
|
149 |
* @return a default feature name
|
150 |
*/
|
151 |
public static QName createDefaultFeature(){ |
152 |
String namespace = gpeManager.getStringProperty(XmlProperties.DEFAULT_NAMESPACE_URI);
|
153 |
String localName = gpeManager.getStringProperty(GmlProperties.DEFAULT_FEATURE);
|
154 |
return new QName(namespace, localName); |
155 |
} |
156 |
} |
157 |
|