public List<Form> searchForm(List<NodeImpl> tokens) {
List<Form> forms = new ArrayList<Form>();
Form form = null;
for(int i = 0; i < tokens.size(); i++) {
NodeImpl node = tokens.get(i);
if(node.isNode(Name.FORM)) {
// 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;