Example #1
0
        public override BaseElement Clone()
        {
            ExtensionElement clone = new ExtensionElement();

            clone.SetValues(this);
            return(clone);
        }
Example #2
0
        public void SetValues(ExtensionElement otherElement)
        {
            name            = otherElement.Name;
            namespacePrefix = otherElement.NamespacePrefix;
            _namespace      = otherElement.NameSpace;
            elementText     = otherElement.ElementText;
            attributes      = otherElement.attributes;

            childElements = new Dictionary <string, List <ExtensionElement> >();
            if (otherElement.ChildElements != null && otherElement.ChildElements.Count() > 0)
            {
                foreach (string key in otherElement.ChildElements.Keys)
                {
                    List <ExtensionElement> otherElementList = otherElement.ChildElements[key];
                    if (otherElementList != null && otherElementList.Count > 0)
                    {
                        List <ExtensionElement> elementList = new List <ExtensionElement>();
                        foreach (ExtensionElement extensionElement in otherElementList)
                        {
                            elementList.Add((ExtensionElement)extensionElement.Clone());
                        }
                        childElements.Add(key, elementList);
                    }
                }
            }
        }
Example #3
0
 public void AddChildElement(ExtensionElement childElement)
 {
     if (childElement != null && (!string.IsNullOrEmpty(childElement.Name)))
     {
         List <ExtensionElement> elementList = null;
         if (!this.childElements.ContainsKey(childElement.Name))
         {
             elementList = new List <ExtensionElement>();
             this.childElements.Add(childElement.Name, elementList);
         }
         this.childElements[childElement.Name].Add(childElement);
     }
 }