【问题标题】:How to read html element values from string which contains the html code [duplicate]如何从包含html代码的字符串中读取html元素值[重复]
【发布时间】:2016-05-28 16:57:19
【问题描述】:

以下是示例 html 代码,我在 String 变量中有类似的代码,我需要读取仅“选择”的每个值并将其添加到某个集合中。提前致谢。

`

<head>

<title> Sample HTML </title>

</head>

<body>

<form id="form1" runat="server">

  <h3> Sample Example </h3>

  <p>Select items from the list<p> 

  <select id="Select1" runat="server">
     <option value="Text for Item 1" selected="selected"> Item 1 </option>
     <option value="Text for Item 2">Item 2</option>
     <option value="Text for Item 3">Item 3</option>
     <option value="Text for Item 4">Item 4</option>
     <option value="Text for Item 5">Item 5</option>
     <option value="Text for Item 6">Item 6</option>
  </select>   

</form>

</body>

</html>`

【问题讨论】:

    标签: c# html webclient


    【解决方案1】:

    您可以使用 HTML Agility 工具包来阅读 HTML。 访问以下链接。 How to use HTML Agility pack

    https://htmlagilitypack.codeplex.com

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-29
      • 1970-01-01
      • 1970-01-01
      • 2019-01-28
      • 2018-02-20
      • 2014-04-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多