private static Ratings getRatings(Element e) {
   if (e == null) {
     return null;
   }
   Ratings r = new Ratings();
   r.setAvg(DOUBLE.safeValue(e.getChildText("avg")));
   r.setVotes(INTEGER.safeValue(e.getChildText("votes")));
   r.setHistory(new HashMap<String, Integer>());
   populateMap(r.getHistory(), e.getChild("history"));
   return r;
 }
 public static Drop extractDrop(Document doc) {
   Drop d = new Drop();
   Element iq = doc.getRootElement();
   Element drop = iq.getChild("drop");
   d.setId(drop.getChildText("id"));
   d.setCreatorId(drop.getChildText("creatorId"));
   d.setCreationDate(DATE.safeValue(drop.getChildText("creationDate")));
   d.setLastEditorId(drop.getChildText("lastEditorId"));
   d.setLastEditDate(DATE.safeValue(drop.getChildText("lastEditDate")));
   d.setVersion(INTEGER.safeValue(drop.getChildText("version")));
   d.setPath(drop.getChildText("path"));
   d.setFlowId(drop.getChildText("flowId"));
   d.setParentDropId(drop.getChildText("parentDropId"));
   d.setFhash(drop.getChildText("fhash"));
   d.setActions(new HashMap<String, Boolean>());
   populateMap(d.getActions(), drop.getChild("actions"));
   d.setCreator(new HashMap<String, String>());
   populateMap(d.getCreator(), drop.getChild("creator"));
   d.setFlags(new HashMap<String, Integer>());
   populateMap(d.getFlags(), drop.getChild("flags"));
   d.setRatings(getRatings(drop.getChild("ratings")));
   d.setElems(getElements(drop.getChild("elems")));
   return d;
 }
 private static Object toTypedValue(Element e) {
   String typeAttribute = e.getAttributeValue("type");
   String content = e.getText();
   TypeConverter<?> t = typeConverters.get(typeAttribute);
   return t == null ? content : t.safeValue(content);
 }