Statistics
| Revision:

root / branches / v2_0_0_prep / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / layers / operations / VectorialXMLItem.java @ 21200

History | View | Annotate | Download (1.56 KB)

1
package org.gvsig.fmap.mapcontext.layers.operations;
2

    
3
import java.util.BitSet;
4

    
5
import org.gvsig.data.ReadException;
6
import org.gvsig.data.vectorial.FeatureStore;
7
import org.gvsig.fmap.mapcontext.layers.FLayer;
8
import org.xml.sax.ContentHandler;
9
import org.xml.sax.SAXException;
10
import org.xml.sax.helpers.AttributesImpl;
11

    
12

    
13
public class VectorialXMLItem implements XMLItem {
14

    
15
        private BitSet bitset;
16
        private FLayer layer;
17

    
18
        public VectorialXMLItem(BitSet bitset, FLayer layer) {
19
                this.bitset = bitset;
20
                this.layer = layer;
21
        }
22

    
23
        public FLayer getLayer(){
24
                return layer;
25
        }
26
        /**
27
         * @see com.iver.cit.gvsig.gui.toolListeners.InfoListener.XMLItem#parse(org.xml.sax.ContentHandler)
28
         */
29
        public void parse(ContentHandler handler) throws SAXException {
30
                AttributesImpl aii = new AttributesImpl();
31
                handler.startElement("", "", ((FLayer) layer).getName(), aii);
32
                try {
33

    
34
                        FeatureStore ds = ((AlphanumericData) layer).getFeatureStore();
35
                        //TODO
36
//                        ds.start();
37
//
38
//                        for (int j = bitset.nextSetBit(0); j >= 0; j = bitset
39
//                                        .nextSetBit(j + 1)) {
40
//                                AttributesImpl ai = new AttributesImpl();
41
//
42
//                                for (int k = 0; k < ds.getFieldCount(); k++) {
43
//                                        ai.addAttribute("", ds.getFieldName(k), "",
44
//                                                        "xs:string", ds.getFieldValue(j, k).toString());
45
//                                }
46
//                                handler.startElement("", "", String.valueOf(j), ai);
47
//                                handler.endElement("", "", String.valueOf(j));
48
//                        }
49
//
50
//                        ds.stop();
51

    
52
                } catch (ReadException e) {
53
                        throw new SAXException(e);
54
                }
55
                handler.endElement("", "", ((FLayer) layer).getName());
56
        }
57
}
58