svn-gvsig-desktop / tags / v1_1_Build_1015 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / GDBMSHandler.java @ 13679
History | View | Annotate | Download (3.15 KB)
1 |
package com.iver.cit.gvsig.fmap.layers; |
---|---|
2 |
|
3 |
import com.iver.utiles.XMLEntity; |
4 |
|
5 |
import org.xml.sax.Attributes; |
6 |
import org.xml.sax.ContentHandler; |
7 |
import org.xml.sax.Locator; |
8 |
import org.xml.sax.SAXException; |
9 |
|
10 |
import java.util.Stack; |
11 |
|
12 |
|
13 |
/**
|
14 |
* Maneja los eventos de GDBMS para obtener un XMLEntity con la
|
15 |
* informaci?n
|
16 |
*
|
17 |
* @author Fernando Gonz?lez Cort?s
|
18 |
*/
|
19 |
public class GDBMSHandler implements ContentHandler { |
20 |
private Stack entities = new Stack(); |
21 |
private XMLEntity last;
|
22 |
|
23 |
/**
|
24 |
* @see org.xml.sax.ContentHandler#endDocument()
|
25 |
*/
|
26 |
public void endDocument() throws SAXException { |
27 |
// TODO Auto-generated method stub
|
28 |
} |
29 |
|
30 |
/**
|
31 |
* @see org.xml.sax.ContentHandler#startDocument()
|
32 |
*/
|
33 |
public void startDocument() throws SAXException { |
34 |
// TODO Auto-generated method stub
|
35 |
} |
36 |
|
37 |
/**
|
38 |
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
|
39 |
*/
|
40 |
public void characters(char[] ch, int start, int length) |
41 |
throws SAXException {
|
42 |
// TODO Auto-generated method stub
|
43 |
} |
44 |
|
45 |
/**
|
46 |
* @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
|
47 |
*/
|
48 |
public void ignorableWhitespace(char[] ch, int start, int length) |
49 |
throws SAXException {
|
50 |
// TODO Auto-generated method stub
|
51 |
} |
52 |
|
53 |
/**
|
54 |
* @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
|
55 |
*/
|
56 |
public void endPrefixMapping(String prefix) throws SAXException { |
57 |
// TODO Auto-generated method stub
|
58 |
} |
59 |
|
60 |
/**
|
61 |
* @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String)
|
62 |
*/
|
63 |
public void skippedEntity(String name) throws SAXException { |
64 |
// TODO Auto-generated method stub
|
65 |
} |
66 |
|
67 |
/**
|
68 |
* @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
|
69 |
*/
|
70 |
public void setDocumentLocator(Locator locator) { |
71 |
// TODO Auto-generated method stub
|
72 |
} |
73 |
|
74 |
/**
|
75 |
* @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String,
|
76 |
* java.lang.String)
|
77 |
*/
|
78 |
public void processingInstruction(String target, String data) |
79 |
throws SAXException {
|
80 |
// TODO Auto-generated method stub
|
81 |
} |
82 |
|
83 |
/**
|
84 |
* @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String,
|
85 |
* java.lang.String)
|
86 |
*/
|
87 |
public void startPrefixMapping(String prefix, String uri) |
88 |
throws SAXException {
|
89 |
// TODO Auto-generated method stub
|
90 |
} |
91 |
|
92 |
/**
|
93 |
* @see org.xml.sax.ContentHandler#endElement(java.lang.String,
|
94 |
* java.lang.String, java.lang.String)
|
95 |
*/
|
96 |
public void endElement(String namespaceURI, String localName, String qName) |
97 |
throws SAXException {
|
98 |
last = (XMLEntity) entities.pop(); |
99 |
} |
100 |
|
101 |
/**
|
102 |
* @see org.xml.sax.ContentHandler#startElement(java.lang.String,
|
103 |
* java.lang.String, java.lang.String, org.xml.sax.Attributes)
|
104 |
*/
|
105 |
public void startElement(String namespaceURI, String localName, |
106 |
String qName, Attributes atts) throws SAXException { |
107 |
//Configuramos el xml entity
|
108 |
XMLEntity xml = new XMLEntity();
|
109 |
xml.setName(qName); |
110 |
|
111 |
for (int i = 0; i < atts.getLength(); i++) { |
112 |
String name = atts.getQName(i);
|
113 |
String value = atts.getValue(i);
|
114 |
xml.putProperty(name, value); |
115 |
} |
116 |
|
117 |
if (!entities.isEmpty()) {
|
118 |
XMLEntity parent = (XMLEntity) entities.peek(); |
119 |
parent.addChild(xml); |
120 |
} |
121 |
|
122 |
entities.push(xml); |
123 |
} |
124 |
|
125 |
/**
|
126 |
* DOCUMENT ME!
|
127 |
*
|
128 |
* @return DOCUMENT ME!
|
129 |
*/
|
130 |
public XMLEntity getXMLEntity() {
|
131 |
return last;
|
132 |
} |
133 |
} |