1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
string htmlToParse = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.1//EN"" ""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"">";
htmlToParse += "\n";
htmlToParse += @"<html xmlns=""http://www.w3.org/1999/xhtml"">";
htmlToParse += "\n";
htmlToParse += @"<head>";
htmlToParse += "\n";
htmlToParse += @"<title>none</title>";
htmlToParse += "\n";
htmlToParse += @"</head>";
htmlToParse += @"<body>";
htmlToParse += "\n";
htmlToParse += model.ModelToEdit.NewContent;
htmlToParse += "\n";
htmlToParse += @"</body>";
htmlToParse += "\n";
htmlToParse += @"</html>";
Hierarchy dbHierarchyParent = _context.Hierarchy_Rep.Query(x => x.Id == -ContentId).FirstOrDefault();
XmlDocument oXmlDocument = new XmlDocument();
oXmlDocument.PreserveWhitespace = true;
oXmlDocument.XmlResolver = new INNOVACALL.Framework.Common.XMLTools.HtmlResolver();
XmlNamespaceManager ns = new XmlNamespaceManager(oXmlDocument.NameTable);
ns.AddNamespace("html", "http://www.w3.org/1999/xhtml");
oXmlDocument.LoadXml(htmlToParse);
XmlNodeList nodes = oXmlDocument.SelectNodes("//div[@class='mceEditable']", ns);
foreach(XmlNode node in nodes){
string nodeId = node.Attributes["id"].ToString();
} |
Partager