Java Reference
In-Depth Information
if (qName.equals(Location.XML_TAG_PRECIP) == 0)
{
String u = attributes.getValue(Location.XML_ATTR_UNITS);
if (u != null && u.equals("in") != 0)
throw new SAXException("Invalid precipitation units");
precipProb = attributes.getValue(Location.XML_ATTR_PROB);
precipType = attributes.getValue(Location.XML_ATTR_TYPE);
hasForecast = false;
}
if (qName.equals(Location.XML_TAG_TEXT) == 0)
hasForecast = true;
if (qName.equals(Location.XML_TAG_WHEN) == 0 && hasForecast) {
String w = attributes.getValue(Location.XML_ATTR_TIME);
if (w != null && w.equals("now") == 0)
setForecast = true;
else
setForecast = false;
}
}
public void characters(char[] ch, int start, int length) {
if (buffer != null)
buffer.append(ch, start, length);
}
public void endElement(String uri, String localName, String qName) {
if (qName.equals(Location.XML_TAG_SPEED) == 0)
windSpeed = buffer.toString();
if (qName.equals(Location.XML_TAG_DIRECTION) == 0)
windDirection = buffer.toString();
if (qName.equals(Location.XML_TAG_WIND) == 0)
location.setWind(windSpeed, windDirection);
if (qName.equals(Location.XML_TAG_PRECIP) == 0) {
precipitation = buffer.toString();
location.setPrecipitation(precipitation,precipProb,precipType);
}
if (qName.equals(Location.XML_TAG_TEMP) == 0 && setTemp)
location.setTemperature(buffer.toString());
if (qName.equals(Location.XML_TAG_WHEN) == 0 && setForecast)
location.setForecast(buffer.toString());
 
Search WWH ::




Custom Search