HTMLAgilityPack does not close image tags.

html-agility-pack

Question

When writing a new image node with the HTMLAgilityPack, it seems to remove the closing tag for the image, as in should be but has when you examine the outer html.

string strIMG = "<img src='" + imgPath + "' height='" + pubImg.Height + "px' width='" + pubImg.Width + "px' />";

HtmlNode newNode = HtmlNode.Create(strIMG);

This invalidates xhtml.

1
10
4/17/2009 7:22:41 AM

Popular Answer

Micky's suggestion to tell it to produce XML works, but if you have further reasons not to want XML, try this:

doc.OptionWriteEmptyNodes = true;
20
11/24/2009 11:43:17 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow