BExIS.Web.Shell.Areas.DCM.Helpers.DCMSeedDataGenerator.createMissingNodes C# (CSharp) Method

createMissingNodes() private static method

Add missing node to the desitnation document
private static createMissingNodes ( string destinationParentXPath, XmlNode parentNode, XmlDocument doc ) : XmlNode
destinationParentXPath string
parentNode System.Xml.XmlNode
doc System.Xml.XmlDocument
return System.Xml.XmlNode
        private static XmlNode createMissingNodes(string destinationParentXPath, XmlNode parentNode, XmlDocument doc)
        {
            string dif = destinationParentXPath;

            List<string> temp = dif.Split('/').ToList();
            temp.RemoveAt(0);

            XmlNode parentTemp = parentNode;

            foreach (string s in temp)
            {
                if (XmlUtility.GetXmlNodeByName(parentTemp, s) == null)
                {
                    XmlNode t = XmlUtility.CreateNode(s, doc);

                    parentTemp.AppendChild(t);
                    parentTemp = t;
                }
                else
                {
                    XmlNode t = XmlUtility.GetXmlNodeByName(parentTemp, s);
                    parentTemp = t;
                }
            }

            return parentTemp;
        }