本文整理汇总了C#中HtmlDocument.Save方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlDocument.Save方法的具体用法?C# HtmlDocument.Save怎么用?C# HtmlDocument.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlDocument
的用法示例。
在下文中一共展示了HtmlDocument.Save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
HtmlDocument doc = new HtmlDocument();
doc.Load(@"..\..\mshome.htm");
doc.OptionOutputAsXml = true;
doc.Save("mshome.xml");
}
示例2: StackOverflow
public void StackOverflow()
{
var url = "http://rewarding.me/active-tel-domains/index.php/index.php?rescan=amour.tel&w=A&url=&by=us&limits=0";
var request = WebRequest.Create(url);
var htmlDocument = new HtmlDocument();
htmlDocument.Load((request.GetResponse()).GetResponseStream());
Stream memoryStream = new MemoryStream();
htmlDocument.Save(memoryStream);
}
示例3: Test_Constructing_Node_With_Single_Attribute
public void Test_Constructing_Node_With_Single_Attribute()
{
var doc = new HtmlDocument();
var a = doc.CreateElement("a");
a.SetAttributeValue("href", "foo");
a.InnerHtml = "foo";
doc.DocumentNode.AppendChild(a);
Assert.AreEqual("<a href=\"foo\">foo</a>", doc.Save());
}
示例4: Test_Parse_Attribute_Containing_Quote
public void Test_Parse_Attribute_Containing_Quote()
{
var doc = new HtmlDocument("<html><head></head><body><a href=\"f'o'o\">yo</a></body></html>");
Assert.AreEqual("<html><head></head><body><a href=\"f'o'o\">yo</a></body></html>", doc.Save());
}
示例5: Test_SaveXML_Does_Not_Change_Quotes_On_Attributes
public void Test_SaveXML_Does_Not_Change_Quotes_On_Attributes()
{
var doc = new HtmlDocument("<html><head></head><body><a href=\"foo\">yo</a></body></html>");
Assert.AreEqual("<html><head></head><body><a href=\"foo\">yo</a></body></html>", doc.Save());
doc = new HtmlDocument("<html><head></head><body><a href='foo'>yo</a></body></html>");
Assert.AreEqual("<html><head></head><body><a href='foo'>yo</a></body></html>", doc.Save());
}
示例6: Test_SaveXML_Does_Not_Add_Value_To_Attribute_Without_Value_When_Loading
public void Test_SaveXML_Does_Not_Add_Value_To_Attribute_Without_Value_When_Loading()
{
var doc = new HtmlDocument("<html><head></head><body><a href=\"\">yo</a></body></html>");
var html = doc.Save();
Assert.AreEqual("<html><head></head><body><a href=\"\">yo</a></body></html>", html);
}
示例7: Test_SaveXML_Does_Not_Add_Quote_To_Attribute_Loading_And_Attribute_Is_Not_Empty
public void Test_SaveXML_Does_Not_Add_Quote_To_Attribute_Loading_And_Attribute_Is_Not_Empty()
{
var doc = new HtmlDocument("<html><head></head><body><a href=foo>yo</a></body></html>");
var html = doc.Save();
Assert.AreEqual("<html><head></head><body><a href=foo>yo</a></body></html>", html);
}