Ejemplo n.º 1
0
        /////////////////////////////////////////////////////////////////////////////
        #endregion


        /// <summary>
        /// Parses the inner state of the element
        /// </summary>
        /// <param name="e">The extension element that should be added to this entry</param>
        /// <param name="parser">The AtomFeedParser that called this</param>
        public virtual void Parse(ExtensionElementEventArgs e, AtomFeedParser parser)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }


            //Tracing.TraceMsg("Entering Parse on AbstractEntry");
            XmlNode node = e.ExtensionElement;

            if (this.ExtensionFactories != null && this.ExtensionFactories.Count > 0)
            {
                //Tracing.TraceMsg("Entring default Parsing for AbstractEntry");

                IExtensionElementFactory f = FindExtensionFactory(node.LocalName,
                                                                  node.NamespaceURI);
                if (f != null)
                {
                    this.ExtensionElements.Add(f.CreateInstance(node, parser));
                    e.DiscardEntry = true;
                }
            }
            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an extension for a given name and namespace by walking the
        /// extension factories list and calling CreateInstance for the right one
        /// </summary>
        /// <param name="localName">the xml local name of the element to find</param>
        /// <param name="ns">the namespace of the element to find</param>
        /// <returns>Object</returns>
        public IExtensionElementFactory CreateExtension(string localName, string ns)
        {
            IExtensionElementFactory ele = null;
            IExtensionElementFactory f   = FindExtensionFactory(localName, ns);

            if (f != null)
            {
                ele = f.CreateInstance(null, null);
            }
            return(ele);
        }