Code example for Attributes

Methods: getValue

0
//                  System.out.println(localName + " " + qName + " " + attributes.getLength()); 
 
        //System.out.println(qName); 
 
        if (qName.equalsIgnoreCase("node")) {
            lat = Double.parseDouble(attributes.getValue("lat"));
            lon = Double.parseDouble(attributes.getValue("lon"));
            id = attributes.getValue("id");
            //TODO timestamp 
            //                        for (int i = 0; i < attributes.getLength(); i++) { 
            //                            String key = attributes.getQName(i); 
            //                            String value = attributes.getValue(i); 
            //                            System.out.println("  " + key + " " + value); 
            //                        } 
 
             
                 
            //} 
             
         
        } 
         
        //if ((lat >= minLat) && (lat <= maxLat) && (lon >= minLon) && (lon <= maxLon)) { 
        if (qName.equalsIgnoreCase("tag")) {
            //System.out.println(node.keySet().toString() + " " + attributes.keySet().toString()); 
 
            //System.out.println(lat + ", " + lon + "," + attributes.getValue("v")); 
            //System.out.println(lat + ", " + lon + "," + " " + attributes.getValue("v")); 
//            for (int i = 0; i < attributes.getLength(); i++) { 
//                String k = attributes.getQName(i); 
//                String v = attributes.getValue(k); 
//                //System.out.println("  " + k + " " + v); 
//            } 
 
            if (attributes.getValue("k").equalsIgnoreCase("amenity")) {
                //System.out.println(lat + "," + lon + ": " + attributes.getValue("v")); 
                final String v = attributes.getValue("v");
                onAmenity(id + "/" + v, lat, lon, v);
            } 
        } 
 
    }