private Polygon getPolygon(XMLElement source) { Polygon poly = new Polygon(); for (Enumeration e_poly = source.enumerateChildren(); e_poly.hasMoreElements();) { XMLElement tmp_point = (XMLElement) e_poly.nextElement(); if (tmp_point.getName().equals("point")) { poly.addPoint(Integer.parseInt(tmp_point.getStringAttribute("x")), Integer.parseInt(tmp_point .getStringAttribute("y"))); } } return poly; }