I'm building up a complete HTML using C#, using ReplaceChild together with CreateNode. Most works pretty smooth, except for the following:
However, when outputting the strings as can be seen in the bold and italic cases, output stops when the <b> or <i> tags are encountered. They simply do not exist in the resulting output.
What can be the problem? All tags are properly closed, and the output is part of a larger document and all other tags are handled correctly.
switch (node.Attributes["attribute"].Value.ToLower())
{
case "table":
strTest = "<table><tr><td>hello</td><td>world</td></tr></table>";
break;
case "bold":
strTest = "Normal, <b>this is bold</b> and back to normal";
break;
case "italic":
strTest = "Normal, <i>this is italic</i> and back to normal";
break;
default:
break;
}
node.ParentNode.ReplaceChild(HtmlNode.CreateNode(strTest), node);
The table output is rendered correctly. If I add classes, styling can be done neatly in CSS. However, when outputting the strings as can be seen in the bold and italic cases, output stops when the <b> or <i> tags are encountered. They simply do not exist in the resulting output.
What can be the problem? All tags are properly closed, and the output is part of a larger document and all other tags are handled correctly.