Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为我的一个项目废弃 HTML。我在其中有一个 html 列表 ul li 标记元素。我想获取该 ul 中的所有 li 元素。在某些情况下,ul 元素可能不存在,在某些情况下可能只有一个 li。
我该如何处理并获取这些内容?
有任何想法吗?
我会看看HtmlAgilityPack。您可以使用相当简单的 XQuery 表达式来获取<li>元素(如果存在)。
<li>