conn.setRequestProperty("User-Agent", USER_AGENT);
return conn.getInputStream();
}
private Toponym getToponymFromElement(Element toponymElement) {
Toponym toponym = new Toponym();
toponym.setName(toponymElement.getChildText("name"));
toponym.setAlternateNames(toponymElement.getChildText("alternateNames"));
toponym.setLatitude(Double.parseDouble(toponymElement.getChildText("lat")));
toponym.setLongitude(Double.parseDouble(toponymElement.getChildText("lng")));
toponym.setCountryCode(toponymElement.getChildText("countryCode"));
toponym.setCountryName(toponymElement.getChildText("countryName"));
toponym.setFeatureClass(FeatureClass.fromValue(toponymElement.getChildText("fcl")));
toponym.setFeatureCode(toponymElement.getChildText("fcode"));
toponym.setFeatureClassName(toponymElement.getChildText("fclName"));
toponym.setFeatureCodeName(toponymElement.getChildText("fCodeName"));
return toponym;
}