如何在C#中的HTML字符串中操作DOM? [英] How can I manipulate the DOM from a string of HTML in C#?

查看:633
本文介绍了如何在C#中的HTML字符串中操作DOM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我发现能够从包含HTML的字符串中操作DOM的最佳方法是:

For the moment the best way that I have found to be able to manipulate DOM from a string that contain HTML is:

WebBrowser webControl = new WebBrowser();
webControl.DocumentText = html;
HtmlDocument doc = webControl.Document;

有两个问题:


  1. 需要 WebBrowser 对象!

  2. 这不能与多个线程一起使用;我需要一些可以在不同线程上工作的东西(主线程除外)。

  1. Requires the WebBrowser object!
  2. This can't be used with multiple threads; I need something that would work on different thread (other than the main thread).

任何想法?

推荐答案

我搜索了GooglePlex for HTML,我发现 Html敏捷包我不知道这是不是,我现在正在下载试试看。

I did a search to GooglePlex for HTML and I found Html Agility Pack I do not know if it's for that or not, I am downloading it right now to give a try.

这篇关于如何在C#中的HTML字符串中操作DOM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆