0
votes

I am working on a C# application which should be able to go through parts of a html site and show me elements for which I have entered filters.

Now I have a HTML-Page which contains a HTML-Form which I want to select and show in my application window. The Form-Element originally looks like this:

<form action="search.php?searchid=720671&amp;pp=" method="post" class="pagination popupmenu nohovermenu">
    <input type="hidden" name="searchid" value="720671" />
    <input type="hidden" name="pp" value="" />
    <input type="hidden" name="s" value="" />
    <input type="hidden" name="securitytoke" value="guest" />
    <span><a href="javascript://" class="popupctrl">Seite 1 von 2</a></span>
    <span class="selected"><a href="javascript://" title="Zeige Ergebnis 1 bis 25">1</a></span>
    <span> <a rel="nofollow" href="search.php?searchid=720671&amp;pp=&amp;page=2" title="Zeige Ergebnis 26 bis 40">2</a> </span>
    <span class="prev_next"><a rel="next" href="search.php?searchid=720671&amp;pp=&amp;page=2" title="N�chste Seite - Ergebnis 26 bis 40 von"></a></span>
    <ul class="popupbody popuphover">
        <li class="formsubmit jumptopage">
            <label>Gehe zu Seite:
                <input type="text" name="page" size="4" />
            </label>
            <input type="submit" class="button" value="Los" />
        </li>
    </ul>
</form>

But as soon as I load the HTML-Document in the HTMLAgilityPack and select the Form-Element this element is empty. Even the outerHTML of the HTMLNode is empty.

Why is this happening? Could there be an error elsewhere in the document and the HTMLAgilityPack-Extension is wrongly closing right after it has been opened?

1
Show your c#code - Krishna

1 Answers

0
votes

You might want to add this line of code before you load the document.

HtmlNode.ElementsFlags.Remove("form");