// System.out.println("== > thay "+ node + " : "+ node.isOpen() );
if(node.getType() == TypeToken.TAG) {
if(form != null) forms.add(form);
form = new Form();
Attributes attributes = node.getAttributes();
Attribute attribute = attributes.get(NAME_ATTR);
if(attribute != null) form.setName(attribute.getValue());
attribute = attributes.get("method");
if(attribute != null) form.setMethod(attribute.getValue());
attribute = attributes.get(ACTION);
if(attribute != null) form.setAction(attribute.getValue());
} else {
if(form != null) forms.add(form);
form = null;
}
} else if(node.isNode(Name.INPUT)
|| node.isNode(Name.TEXTAREA)
|| node.isNode(Name.SELECT)) {
if(form == null) continue;
Attributes attributes = node.getAttributes();
Attribute attribute = attributes.get(NAME_ATTR);
if(attribute == null) attribute = attributes.get(ID_ATTR);;
if(attribute == null) continue;
String name = attribute.getValue();
if(name == null || name.trim().isEmpty()) continue;
attribute = attributes.get(TYPE_ATTR);
String type = null;
if(attribute != null) type = attribute.getValue();
if(type == null) type = "text";
type = type.trim();
if(type.equalsIgnoreCase("submit")) {
if(name.toLowerCase().indexOf("cancel") > -1
|| name.toLowerCase().indexOf("reset") > -1
|| name.toLowerCase().indexOf("clear") > -1) continue;
}
if("radio".equalsIgnoreCase(type)
|| "checkbox".equalsIgnoreCase(type)) {
attribute = attributes.get("checked");
if(attribute == null) continue;
}
attribute = attributes.get(VALUE);
String value = null;
if(attribute != null) value = attribute.getValue();
if(value == null) value = "";
value = value.trim();
boolean newInput = true;
for(int k = 0; k < form.getParams().size(); k++) {