Example #1
0
        private Node Get(string XPath, bool bCreateIfNotFound)
        {
            string[] names = XPath.Split(".".ToCharArray());
//			if (bCreateIfNotFound)
//				Console.WriteLine(XPath + " createmaybe " + names.Length.ToString());
            Node node = this;

            foreach (string s in names)
            {
                Node newNode = (Node)node.ChildNodes[s];
                if (newNode == null)
                {
                    if (bCreateIfNotFound)
                    {
                        newNode = node.AppendChild(s);                         //CreateChild(s);
//						Console.WriteLine("Create "+s);
                    }
                    else
                    {
                        return(null);
                    }
                }
//				else if (bCreateIfNotFound)
//					Console.WriteLine("Already there "+s);
                node = newNode;
            }
//			if (bCreateIfNotFound)
//				Console.WriteLine("returning "+node.Name);
            return(node);
        }
Example #2
0
        public void AddPath(string XPath, string val)
        {
            Node node = this.GetNode("Paths." + XPath);

            if (node == null)
            {
                return;
            }
            if (!val.EndsWith("\\"))
            {
                val += "\\";
            }
            node.AppendChild(val);
        }