private void ConvertMathMl(HtmlDocument htmlDoc)
{
HtmlNodeCollection mathNodes = htmlDoc.DocumentNode.SelectNodes("//math");
if (mathNodes == null)
{
return;
}
foreach (var mathNode in mathNodes.ToList())
{
mathNode.Attributes.RemoveAll();
HtmlAttribute mathMlNamespaceAttr = htmlDoc.CreateAttribute("xmlns:mml", MathMlNameSpace);
mathNode.Attributes.Add(mathMlNamespaceAttr);
foreach (var node in mathNode.DescendantsAndSelf())
{
node.Name = "mml:" + node.Name;
}
string newMathMlString = String.Format(MathMlOutline, mathNode.OuterHtml);
HtmlCommentNode newMathNode = htmlDoc.CreateComment(newMathMlString);
mathNode.ParentNode.ReplaceChild(newMathNode, mathNode);
}
}