public void SetTocXmlDocument(XmlDocument tocXML) { foreach (XmlNode childNode in tocXML.ChildNodes) { if (childNode.Name == "ncx") { foreach (XmlNode childNode2 in childNode.ChildNodes) { if (childNode2.Name == "navMap") { foreach (XmlNode childNode3 in childNode2.ChildNodes) { try { navPoint navPoint = new navPoint(); a(childNode3, navPoint); navPoint.IsExpanded = true; TocContent.Add(navPoint); } catch { } } } } } } }
private void a(XmlNode A_0, navPoint A_1) { foreach (XmlNode childNode in A_0.ChildNodes) { if (childNode.Name == "navLabel") { A_1.navLabel = childNode.InnerText; } else if (childNode.Name == "content") { A_1.content = childNode.Attributes.GetNamedItem("src").Value; for (int i = 0; i < LImgList.Count; i++) { if (LImgList[i].path.Replace("HYWEB\\", "").Equals(A_1.content)) { A_1.targetIndex = i; break; } } if (!indexContentTable.ContainsKey(A_1.targetIndex)) { indexContentTable.Add(A_1.targetIndex, A_1.navLabel); } } else if (childNode.HasChildNodes || childNode.Name == "navPoint ") { navPoint navPoint = new navPoint(); a(childNode, navPoint); navPoint.IsExpanded = true; A_1.subNavPoint.Add(navPoint); } } }
public void SetTocXmlDocument(XmlDocument tocXML) { foreach (XmlNode childNode in tocXML.ChildNodes) { if (childNode.Name == "ncx") { foreach (XmlNode childNode2 in childNode.ChildNodes) { if (childNode2.Name == "navMap") { foreach (XmlNode childNode3 in childNode2.ChildNodes) { navPoint navPoint = new navPoint(); a(childNode3, navPoint); navPoint.IsExpanded = true; TocContent.Add(navPoint); } } } } } tocTreeView.ItemsSource = TocContent; }