svn-gvsig-desktop / trunk / libraries / libGPE-KML / src / org / gvsig / gpe / kml / writer / v21 / features / ElementWriter.java @ 19680
History | View | Annotate | Download (2.66 KB)
1 |
package org.gvsig.gpe.kml.writer.v21.features; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
|
5 |
import org.gvsig.gpe.kml.utils.KMLUtilsParser; |
6 |
import org.gvsig.gpe.kml.writer.GPEKmlWriterHandlerImplementor; |
7 |
import org.gvsig.gpe.xml.writer.IWriter; |
8 |
|
9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
10 |
*
|
11 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
12 |
*
|
13 |
* This program is free software; you can redistribute it and/or
|
14 |
* modify it under the terms of the GNU General Public License
|
15 |
* as published by the Free Software Foundation; either version 2
|
16 |
* of the License, or (at your option) any later version.
|
17 |
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
26 |
*
|
27 |
* For more information, contact:
|
28 |
*
|
29 |
* Generalitat Valenciana
|
30 |
* Conselleria d'Infraestructures i Transport
|
31 |
* Av. Blasco Ib??ez, 50
|
32 |
* 46010 VALENCIA
|
33 |
* SPAIN
|
34 |
*
|
35 |
* +34 963862235
|
36 |
* gvsig@gva.es
|
37 |
* www.gvsig.gva.es
|
38 |
*
|
39 |
* or
|
40 |
*
|
41 |
* IVER T.I. S.A
|
42 |
* Salamanca 50
|
43 |
* 46005 Valencia
|
44 |
* Spain
|
45 |
*
|
46 |
* +34 963163400
|
47 |
* dac@iver.es
|
48 |
*/
|
49 |
/* CVS MESSAGES:
|
50 |
*
|
51 |
* $Id: ElementWriter.java 361 2008-01-10 08:41:21Z jpiera $
|
52 |
* $Log$
|
53 |
* Revision 1.1 2007/05/16 15:54:20 jorpiell
|
54 |
* Add elements support
|
55 |
*
|
56 |
*
|
57 |
*/
|
58 |
/**
|
59 |
* It parses an element. An element is a tag inside of a
|
60 |
* metadata tag
|
61 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
62 |
*/
|
63 |
public class ElementWriter { |
64 |
|
65 |
/**
|
66 |
* It writes an Element tag
|
67 |
* @param writer
|
68 |
* Writer to write the labels
|
69 |
* @param handler
|
70 |
* The writer handler implementor
|
71 |
* @param name
|
72 |
* Element name
|
73 |
* @param value
|
74 |
* Element value
|
75 |
* @param type
|
76 |
* Element type
|
77 |
* @throws IOException
|
78 |
*/
|
79 |
public void start(IWriter writer, GPEKmlWriterHandlerImplementor handler, String name, Object value, Object type) throws IOException{ |
80 |
writer.write("\n");
|
81 |
writer.write("<" + KMLUtilsParser.addBlancSymbol(name) + ">"); |
82 |
if (value != null){ |
83 |
writer.write(value.toString()); |
84 |
} |
85 |
} |
86 |
|
87 |
/**
|
88 |
* It writes an end Element tag
|
89 |
* @param writer
|
90 |
* Writer to write the labels
|
91 |
* @param handler
|
92 |
* The writer handler implementor
|
93 |
* @param name
|
94 |
* Element name
|
95 |
* @throws IOException
|
96 |
*/
|
97 |
public void end(IWriter writer, GPEKmlWriterHandlerImplementor handler, String name) throws IOException{ |
98 |
writer.write("</" + KMLUtilsParser.addBlancSymbol(name) + ">"); |
99 |
} |
100 |
|
101 |
} |