Ejemplo n.º 1
0
 /// <summary>
 /// used to copy the attribute lists over
 /// </summary>
 /// <param name="factory"></param>
 protected void InitInstance(ExtensionBase factory)
 {
     this.attributes          = null;
     this.attributeNamespaces = null;
     this.unknownChildren     = null;
     for (int i = 0; i < factory.getAttributes().Count; i++)
     {
         string name  = factory.getAttributes().GetKey(i) as string;
         string value = factory.getAttributes().GetByIndex(i) as string;
         this.getAttributes().Add(name, value);
     }
 }
Ejemplo n.º 2
0
        /// <summary>Parses an xml node to create an instance of this  object.</summary>
        /// <param name="node">the xml parses node, can be NULL</param>
        /// <param name="parser">the xml parser to use if we need to dive deeper</param>
        /// <returns>the created IExtensionElement object</returns>
        public virtual IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
        {
            Tracing.TraceCall();

            ExtensionBase e = null;

            if (node != null)
            {
                object localname = node.LocalName;
                if (!localname.Equals(this.XmlName) ||
                    !node.NamespaceURI.Equals(this.XmlNameSpace))
                {
                    return(null);
                }
            }
            // memberwise close is fine here, as everything is identical beside the value
            e = this.MemberwiseClone() as ExtensionBase;
            e.InitInstance(this);

            e.ProcessAttributes(node);
            e.ProcessChildNodes(node, parser);

            return(e);
        }