/** @see Parser#endElement(java.lang.String, java.lang.String, java.lang.String) */ public final void endElement(String uri, String localName, String qName) { // System.out.println("parsing </"+qName+">"); String chars = getChars(); if (qName.equals("attraction")) { attractions.addElement(attraction); attraction = null; } else if (qName.equals("street")) { attraction.setStreet(chars); } else if (qName.equals("latitude")) { attraction.setLatitude(chars); } else if (qName.equals("longitude")) { attraction.setLongitude(chars); } else if (qName.equals("imageUrl")) { attraction.setImageUrl(chars); } else if (qName.equals("description")) { attraction.setDescription(chars); } }
/** * @see Parser#startElement(java.lang.String, java.lang.String, java.lang.String, * org.xml.sax.Attributes) */ public final void startElement( String uri, String localName, String qName, Attributes attributes) { super.startElement(uri, localName, qName, attributes); if (qName.equals("guide")) { for (int i = 0; i < attributes.getLength(); i++) { // Get names and values for each attribute String name = attributes.getQName(i); String value = attributes.getValue(i); if (name.equals("country")) { guide.setCountry(value); } else if (name.equals("latitude")) { guide.setLatitude(value); } else if (name.equals("longitude")) { guide.setLongitude(value); } else if (name.equals("urlPrefix")) { guide.setUrlPrefix(value); } } } else if (qName.equals("attraction")) { attraction = new Attraction(); attraction.setGuide(guide); // Process each attribute for (int i = 0; i < attributes.getLength(); i++) { // Get names and values for each attribute String name = attributes.getQName(i); String value = attributes.getValue(i); if (name.equals("id")) { attraction.setId(value); } else if (name.equals("name")) { attraction.setName(value); } else if (name.equals("thumbnailUrl")) { attraction.setThumbnailUrl(value); } else if (name.equals("type")) { attraction.setType(value); } } } }