/** * Give a Document, parse it and return all form data. * * @param doc * @return null if this Document has more than one form or does not have form */ private static Map<String, String> getFormData(Document doc){ Elements formElements = doc.getElementsByTag("form"); if(formElements.size() != 1) return null; List<FormElement> forms = formElements.forms(); List<KeyVal> data = forms.get(0).formData(); HashMap<String, String> map = new HashMap<String, String>(); for(KeyVal kv: data){ map.put(kv.key(), kv.value()); } return map; }
public Collection<KeyVal> getData1() { return data1; }
public void setData1(Collection<KeyVal> data1) { this.data1 = data1; }