Example #1
0
        //////////////////////////////////////////////////////////////////////
        /// <summary>Parses an xml node to create a Where  object.</summary>
        /// <param name="node">the node to parse node</param>
        /// <param name="parser">the xml parser to use if we need to dive deeper</param>
        /// <returns>the created Where  object</returns>
        //////////////////////////////////////////////////////////////////////
        public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
        {
            Tracing.TraceCall();
            Comments comments = null;

            if (node != null)
            {
                object localname = node.LocalName;
                if (!localname.Equals(this.XmlName) ||
                    !node.NamespaceURI.Equals(this.XmlNameSpace))
                {
                    return(null);
                }
            }

            comments = new Comments();

            if (node != null)
            {
                if (node.HasChildNodes)
                {
                    XmlNode commentsChild = node.FirstChild;
                    while (commentsChild != null && commentsChild is XmlElement)
                    {
                        if (commentsChild.LocalName == GDataParserNameTable.XmlFeedLinkElement &&
                            commentsChild.NamespaceURI == BaseNameTable.gNamespace)
                        {
                            if (comments.FeedLink == null)
                            {
                                comments.FeedLink = FeedLink.ParseFeedLink(commentsChild);
                            }
                            else
                            {
                                throw new ArgumentException("Only one feedLink is allowed inside the gd:comments");
                            }
                        }
                        commentsChild = commentsChild.NextSibling;
                    }
                }
            }
            return(comments);
        }
 //////////////////////////////////////////////////////////////////////
 /// <summary>Parses an xml node to create a Where  object.</summary>
 /// <param name="node">the node to parse node</param>
 /// <param name="parser">the xml parser to use if we need to dive deeper</param>
 /// <returns>the created Where  object</returns>
 //////////////////////////////////////////////////////////////////////
 public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
 {
     return(FeedLink.ParseFeedLink(node));
 }