private FormObjectCollection BuildFormsCollection() { FormObjectCollection objects = new FormObjectCollection(); this.EnsureHtmlParser(); foreach (IHTMLFormElement element in this._parsedHtml.forms) { string elementId = this.GetElementId(element as IHTMLElement); if (elementId == null) { elementId = element.name; } FormObject item = new FormObject(elementId, element.method, element.action); foreach (IHTMLElement element2 in element) { IHTMLInputElement element3 = element2 as IHTMLInputElement; if (element3 != null) { elementId = this.GetElementId(element3 as IHTMLElement); if (elementId == null) { elementId = element3.name; } item.AddField(elementId, element3.value); } } objects.Add(item); } return(objects); }
private FormObjectCollection BuildFormsCollection() { FormObjectCollection forms = new FormObjectCollection(); EnsureHtmlParser(); foreach (IHTMLFormElement form in _parsedHtml.forms) { string id = GetElementId(form as IHTMLElement); if (null == id) { id = form.name; } FormObject f = new FormObject(id, form.method, form.action); foreach (IHTMLElement element in form) { IHTMLInputElement input = element as IHTMLInputElement; if (null != input) { id = GetElementId(input as IHTMLElement); if (null == id) { id = input.name; } f.AddField(id, input.value); } System.Runtime.InteropServices.Marshal.ReleaseComObject(element); } forms.Add(f); System.Runtime.InteropServices.Marshal.ReleaseComObject(form); } return(forms); }