This project has moved and is read-only. For the latest updates, please go here.

SelectSingleNode("//form") does not work correctly

Topics: Developer Forum
Jan 11, 2011 at 6:45 AM

I wrote a simple html file

        <title>testing ...</title>
        <div class="n1">
            <div class="n2">
                <form name="form1" method="post">
                    <div class="n3">
                        <div class="n4">

and selected two nodes from this Html doc

HtmlNode form = html.DocumentNode.SelectSingleNode("//form");
HtmlNode divn3 = html.DocumentNode.SelectSingleNode("//div[@class='n3']");

what I'm getting is
(1) form.InnerHtml is "<form name="form1" method="post">"
(2) form.HasChildNodes returns 'false'
(3) form.ParentNode equals to divn3.ParentNode

Does anyone else encounter this? Am I missing something?
Mar 10, 2011 at 10:21 AM

see it here :