// adds new element(s) // several tags can be concattenated by dots // in that case as many subelements as tags are created public XMLElement AddChild(string TagName, string Content) { string[] parts = TagName.Split('.'); XMLElement currentParent = this; for (int i = 0; i < parts.Length - 1; ++i) { XMLElement existingChild = currentParent.FindByType(parts[i]); if (existingChild != null) { currentParent = existingChild; } else { XMLElement newChild = new XMLElement(parts[i]); currentParent.AddChild(newChild); currentParent = newChild; } } XMLElement newElement = new XMLElement(parts[parts.Length - 1], Content); currentParent.AddChild(newElement); return(newElement); }