Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用C#HtmlAgilityPack解析HTML表单中的输入类型_C#_Html_Forms - Fatal编程技术网

如何使用C#HtmlAgilityPack解析HTML表单中的输入类型

如何使用C#HtmlAgilityPack解析HTML表单中的输入类型,c#,html,forms,C#,Html,Forms,我有这些HTML表单,我试图在其中获取输入值 <form action="/checkout/cart" method="POST" class="update-qty-form"> <div class="quantity num-selector"> <input type="tel" value="1" name="qty" maxlength="3" class="quantity-increment"> </di

我有这些HTML表单,我试图在其中获取输入值

<form action="/checkout/cart" method="POST" class="update-qty-form">
    <div class="quantity num-selector">
        <input type="tel" value="1" name="qty" maxlength="3" class="quantity-increment">
    </div>
</form>

我们最近使用这段代码从属性中提取数据:

var htmlDoc = new HtmlDocument();
 htmlDoc.LoadHtml(@"<form action='/checkout/cart' method='POST' class='update-qty-form'><div class='quantity num-selector'><input type='tel' value='1' name='qty' maxlength='3' class='quantity-increment'></div></form>");


var value = htmlDoc.DocumentNode.SelectSingleNode("//input").Attributes["value"].Value;
var htmlDoc=new HtmlDocument();
htmlDoc.LoadHtml(@“);
var value=htmlDoc.DocumentNode.SelectSingleNode(//输入”).Attributes[“value”].value;
希望它有助于

可能重复的
var htmlDoc = new HtmlDocument();
 htmlDoc.LoadHtml(@"<form action='/checkout/cart' method='POST' class='update-qty-form'><div class='quantity num-selector'><input type='tel' value='1' name='qty' maxlength='3' class='quantity-increment'></div></form>");


var value = htmlDoc.DocumentNode.SelectSingleNode("//input").Attributes["value"].Value;