Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: not closing element properly

$
0
0

var sb = new StringBuilder("<html>\r\t<body>\r\t\t<select>\r");
sb.AppendLine("\t\t\t<option value =\"foobar\" selected=\"selected\">FooBar</option>");
sb.AppendLine("\t\t\t<option value =\"foo\">foo</option>");
sb.AppendLine("\t\t\t<option value =\"bar\">bar</option>");
sb.AppendLine("\t\t</select>\r\t</body>\r</html>");var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(sb.ToString());var sb2 = new StringBuilder();var sw = new StringWriter(sb2);
htmlDoc.Save(sw);
Assert.AreEqual(sb.ToString(), sb2.ToString());
here is the input:
<html><body><select><optionvalue="foobar"selected="selected">FooBar</option><optionvalue="foo">foo</option><optionvalue="bar">bar</option></select></body></html>
this is the output:
<html><body><select><optionvalue="foobar"selected="selected">FooBar<optionvalue="foo">foo<optionvalue="bar">bar</select></body></html>

Viewing all articles
Browse latest Browse all 655

Trending Articles