private void loadNodeRange(CustomTreeRoot root, XPathNavigator nav, List<ProcessingNode> tParent, String linkType) { XPathNodeIterator nodes = nav.Select("Component"); foreach (XPathNavigator navChild in nodes) { ProcessingNode childNode = CreateNodeAndProcessFunctions(navChild, linkType); if (useNodeMap) { root.AddNodeToMap(childNode); } tParent.Add(childNode); if (navChild.HasChildren) { loadNodes(root, navChild, childNode); } } }
private void loadNodes(CustomTreeRoot root, XPathNavigator nav, ProcessingNode tParent) { XPathNodeIterator nodes = nav.Select("Component"); foreach (XPathNavigator navChild in nodes) { ProcessingNode childNode = CreateNodeAndProcessFunctions(navChild, tParent.LinkType); if (useNodeMap) { root.AddNodeToMap(childNode); } // do we need to branch? if (childNode.Functions.Count > 0 && childNode.Functions[0].FunctionName.Equals("RootBranch") && !branching) { branching = true; String dynamicLink = this.Controller.GetDynamicLinkType(root.LinkType, ""+childNode.NodeID); IXPathNavigable iRootNav = this.Controller.GetComponentAndChildren(childNode.NodeID, childNode.NodeID, dynamicLink, new ComponentOptions()); XPathNavigator newRootNav = iRootNav.CreateNavigator(); // optional transform try { CustomTreeRoot xslBuilder = new CustomTreeRoot(); xslBuilder.Controller = this.Controller; xslBuilder.Xsl = childNode.Functions[0].FunctionAction; if (xslBuilder.Transform != null) { XmlDocument newDocument = new XmlDocument(); using (XmlWriter writer = newDocument.CreateNavigator().AppendChild()) { xslBuilder.Transform.Transform(iRootNav, (XsltArgumentList)null, writer); } newRootNav = newDocument.CreateNavigator(); } } catch (Exception e) { MessageBox.Show(e.Message); } finally { newRootNav.SelectSingleNode("Components/Component/@LinkID").SetValue("" + childNode.LinkID.Value); XPathNavigator newRootComponents = newRootNav.SelectSingleNode("Components"); if (newRootComponents != null) { tParent.LinkType = dynamicLink; loadNodes(root, newRootComponents, tParent); branching = false; } } } else { tParent.Nodes.Add(childNode); if (navChild.HasChildren) { loadNodes(root, navChild, childNode); } } } }