c# - Use HtmlAgilityPack to parse HTML variable, not HTML document? -
i have variable in program contains html data string. variable, htmltext
, contains following:
<ul><li><u>mode selector </u></li><li><u>land alt</u></li>
i'd iterate through html, using htmlagilitypack, every example see tries load html document. have html want parse within variable htmltext
. can show me how parse this, without loading document?
the example i'm looking @ right looks this:
static void main(string[] args) { var web = new htmlweb(); var doc = web.load("http://www.stackoverflow.com"); var nodes = doc.documentnode.selectnodes("//a[@href]"); foreach (var node in nodes) { console.writeline(node.innerhtml); } }
i want convert use htmltext
, find underline
elements within. don't want load document since have html want parse stored in variable.
you can use loadhtml
method of htmldocument
class
Comments
Post a Comment