OneNoteConversionTool.FormatReaders.EpubReader.ConvertMathMl C# (CSharp) Method

ConvertMathMl() private method

Converts the MathML blocks to be readable by OneNote
private ConvertMathMl ( HtmlAgilityPack.HtmlDocument htmlDoc ) : void
htmlDoc HtmlAgilityPack.HtmlDocument
return void
		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);
			}
		}