HtmlAgility-将解析保存为字符串 [英] HtmlAgility - Save parsing to a string

查看:79
本文介绍了HtmlAgility-将解析保存为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一次尝试使用HtmlAgility Pack并遇到问题.

Just tried using the HtmlAgility Pack for the first time and have a problem.

首先,我从一个字符串变量中加载.

First I load in from a string variable.

string NewsText = dr["Message"].ToString();
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.LoadHtml(NewsText);
//doing my stuff...

然后,我想将所做的更改保存在字符串NewsText中.我怎么做? htmlDoc.toString()无法正常工作.

Then I want to save my changes in the string NewsText. How do I do that? htmlDoc.toString() didnt work.

谢谢!

推荐答案

您正在寻找htmlDoc.DocumentNode.OuterHtml.

这篇关于HtmlAgility-将解析保存为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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