Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / GDBMSHandler.java @ 1836

History | View | Annotate | Download (3.01 KB)

1
package com.iver.cit.gvsig.fmap.layers;
2

    
3
import java.util.Stack;
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 com.iver.utiles.XMLEntity;
11

    
12
/**
13
 * @author Fernando Gonz?lez Cort?s
14
 */
15
public class GDBMSHandler implements ContentHandler{
16

    
17
        private Stack entities = new Stack();
18
        private XMLEntity last;
19
        
20
        /**
21
         * @see org.xml.sax.ContentHandler#endDocument()
22
         */
23
        public void endDocument() throws SAXException {
24
                // TODO Auto-generated method stub
25
                
26
        }
27

    
28
        /**
29
         * @see org.xml.sax.ContentHandler#startDocument()
30
         */
31
        public void startDocument() throws SAXException {
32
                // TODO Auto-generated method stub
33
                
34
        }
35

    
36
        /**
37
         * @see org.xml.sax.ContentHandler#characters(char[], int, int)
38
         */
39
        public void characters(char[] ch, int start, int length) throws SAXException {
40
                // TODO Auto-generated method stub
41
                
42
        }
43

    
44
        /**
45
         * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
46
         */
47
        public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
48
                // TODO Auto-generated method stub
49
                
50
        }
51

    
52
        /**
53
         * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
54
         */
55
        public void endPrefixMapping(String prefix) throws SAXException {
56
                // TODO Auto-generated method stub
57
                
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
        /**
69
         * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
70
         */
71
        public void setDocumentLocator(Locator locator) {
72
                // TODO Auto-generated method stub
73
                
74
        }
75

    
76
        /**
77
         * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String)
78
         */
79
        public void processingInstruction(String target, String data) throws SAXException {
80
                // TODO Auto-generated method stub
81
                
82
        }
83

    
84
        /**
85
         * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String)
86
         */
87
        public void startPrefixMapping(String prefix, String uri) throws SAXException {
88
                // TODO Auto-generated method stub
89
                
90
        }
91

    
92
        /**
93
         * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
94
         */
95
        public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
96
                last = (XMLEntity) entities.pop();
97
        }
98

    
99
        /**
100
         * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
101
         */
102
        public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
103
                //Configuramos el xml entity
104
                XMLEntity xml = new XMLEntity();
105
                xml.setName(qName);
106
                for (int i = 0; i < atts.getLength(); i++) {
107
                        String name = atts.getQName(i);
108
                        String value = atts.getValue(i);
109
                        xml.putProperty(name, value);
110
                }
111
                
112
                if (!entities.isEmpty()){
113
                        XMLEntity parent = (XMLEntity) entities.peek();
114
                        parent.addChild(xml);
115
                }
116
                
117
                entities.push(xml);
118
        }
119

    
120
        public XMLEntity getXMLEntity() {
121
                return last;
122
        }
123
}