/// <summary>
        /// Loads this <see cref="BlogMLAuthor"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="BlogMLAuthor"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="BlogMLAuthor"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(settings, "settings");
            if (BlogMLUtility.FillCommonObject(this, source, settings))
            {
                wasLoaded = true;
            }
            if (source.HasAttributes)
            {
                string emailAttribute = source.GetAttribute("email", String.Empty);

                if (!String.IsNullOrEmpty(emailAttribute))
                {
                    this.EmailAddress = emailAttribute;
                    wasLoaded         = true;
                }
            }
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);

            adapter.Fill(this);

            return(wasLoaded);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads this <see cref="ApmlApplication"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="ApmlApplication"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="ApmlApplication"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(settings, "settings");
            if (BlogMLUtility.FillCommonObject(this, source, settings))
            {
                wasLoaded = true;
            }
            if (source.HasAttributes)
            {
                string urlAttribute = source.GetAttribute("url", String.Empty);

                if (!String.IsNullOrEmpty(urlAttribute))
                {
                    Uri url;
                    if (Uri.TryCreate(urlAttribute, UriKind.RelativeOrAbsolute, out url))
                    {
                        this.Url  = url;
                        wasLoaded = true;
                    }
                }
            }
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);

            adapter.Fill(this);

            return(wasLoaded);
        }
        /// <summary>
        /// Loads this <see cref="ApmlApplication"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="ApmlApplication"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="ApmlApplication"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(settings, "settings");
            if (BlogMLUtility.FillCommonObject(this, source, settings))
            {
                wasLoaded = true;
            }
            if (source.HasAttributes)
            {
                string parentRefAttribute   = source.GetAttribute("parentref", String.Empty);
                string descriptionAttribute = source.GetAttribute("description", String.Empty);

                if (!String.IsNullOrEmpty(parentRefAttribute))
                {
                    this.ParentId = parentRefAttribute;
                    wasLoaded     = true;
                }

                if (!String.IsNullOrEmpty(descriptionAttribute))
                {
                    this.Description = descriptionAttribute;
                    wasLoaded        = true;
                }
            }
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);

            adapter.Fill(this);

            return(wasLoaded);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Loads this <see cref="BlogMLTrackback"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="BlogMLTrackback"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="BlogMLTrackback"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            if (BlogMLUtility.FillCommonObject(this, source))
            {
                wasLoaded = true;
            }
            if (source.HasAttributes)
            {
                string urlAttribute = source.GetAttribute("url", String.Empty);

                if (!String.IsNullOrEmpty(urlAttribute))
                {
                    Uri url;
                    if (Uri.TryCreate(urlAttribute, UriKind.RelativeOrAbsolute, out url))
                    {
                        this.Url  = url;
                        wasLoaded = true;
                    }
                }
            }

            return(wasLoaded);
        }
        /// <summary>
        /// Loads this <see cref="BlogMLCategory"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="BlogMLCategory"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="BlogMLCategory"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            if (BlogMLUtility.FillCommonObject(this, source))
            {
                wasLoaded = true;
            }
            if (source.HasAttributes)
            {
                string parentRefAttribute   = source.GetAttribute("parentref", String.Empty);
                string descriptionAttribute = source.GetAttribute("description", String.Empty);

                if (!String.IsNullOrEmpty(parentRefAttribute))
                {
                    this.ParentId = parentRefAttribute;
                    wasLoaded     = true;
                }

                if (!String.IsNullOrEmpty(descriptionAttribute))
                {
                    this.Description = descriptionAttribute;
                    wasLoaded        = true;
                }
            }

            return(wasLoaded);
        }
        /// <summary>
        /// Loads this <see cref="BlogMLComment"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="BlogMLComment"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="BlogMLComment"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            XmlNamespaceManager manager = BlogMLUtility.CreateNamespaceManager(source.NameTable);

            if (BlogMLUtility.FillCommonObject(this, source))
            {
                wasLoaded = true;
            }
            if (source.HasAttributes)
            {
                string userNameAttribute  = source.GetAttribute("user-name", String.Empty);
                string userEmailAttribute = source.GetAttribute("user-email", String.Empty);
                string userUrlAttribute   = source.GetAttribute("user-url", String.Empty);

                if (!String.IsNullOrEmpty(userNameAttribute))
                {
                    this.UserName = userNameAttribute;
                    wasLoaded     = true;
                }

                if (!String.IsNullOrEmpty(userEmailAttribute))
                {
                    this.UserEmailAddress = userEmailAttribute;
                    wasLoaded             = true;
                }

                if (!String.IsNullOrEmpty(userUrlAttribute))
                {
                    Uri url;
                    if (Uri.TryCreate(userUrlAttribute, UriKind.RelativeOrAbsolute, out url))
                    {
                        this.UserUrl = url;
                        wasLoaded    = true;
                    }
                }
            }

            if (source.HasChildren)
            {
                XPathNavigator contentNavigator = source.SelectSingleNode("blog:content", manager);
                if (contentNavigator != null)
                {
                    BlogMLTextConstruct content = new BlogMLTextConstruct();
                    if (content.Load(contentNavigator))
                    {
                        this.Content = content;
                        wasLoaded    = true;
                    }
                }
            }

            return(wasLoaded);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Loads this <see cref="ApmlApplication"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="ApmlApplication"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="ApmlApplication"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(settings, "settings");

            //------------------------------------------------------------
            //	Attempt to extract common attributes information
            //------------------------------------------------------------
            if (BlogMLUtility.FillCommonObject(this, source, settings))
            {
                wasLoaded = true;
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication information
            //------------------------------------------------------------
            if (source.HasAttributes)
            {
                string parentRefAttribute   = source.GetAttribute("parentref", String.Empty);
                string descriptionAttribute = source.GetAttribute("description", String.Empty);

                if (!String.IsNullOrEmpty(parentRefAttribute))
                {
                    this.ParentId = parentRefAttribute;
                    wasLoaded     = true;
                }

                if (!String.IsNullOrEmpty(descriptionAttribute))
                {
                    this.Description = descriptionAttribute;
                    wasLoaded        = true;
                }
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication extension information
            //------------------------------------------------------------
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);

            adapter.Fill(this);

            return(wasLoaded);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Loads this <see cref="ApmlApplication"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="ApmlApplication"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="ApmlApplication"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(settings, "settings");

            //------------------------------------------------------------
            //	Attempt to extract common attributes information
            //------------------------------------------------------------
            if (BlogMLUtility.FillCommonObject(this, source, settings))
            {
                wasLoaded = true;
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication information
            //------------------------------------------------------------
            if (source.HasAttributes)
            {
                string urlAttribute = source.GetAttribute("url", String.Empty);

                if (!String.IsNullOrEmpty(urlAttribute))
                {
                    Uri url;
                    if (Uri.TryCreate(urlAttribute, UriKind.RelativeOrAbsolute, out url))
                    {
                        this.Url  = url;
                        wasLoaded = true;
                    }
                }
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication extension information
            //------------------------------------------------------------
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);

            adapter.Fill(this);

            return(wasLoaded);
        }
        /// <summary>
        /// Loads this <see cref="BlogMLAuthor"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="BlogMLAuthor"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="BlogMLAuthor"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");
            if (BlogMLUtility.FillCommonObject(this, source))
            {
                wasLoaded = true;
            }
            if (source.HasAttributes)
            {
                string emailAttribute = source.GetAttribute("email", String.Empty);

                if (!String.IsNullOrEmpty(emailAttribute))
                {
                    this.EmailAddress = emailAttribute;
                    wasLoaded         = true;
                }
            }

            return(wasLoaded);
        }
Ejemplo n.º 10
0
        //============================================================
        //	PUBLIC METHODS
        //============================================================
        #region Load(XPathNavigator source)
        /// <summary>
        /// Loads this <see cref="BlogMLAuthor"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="BlogMLAuthor"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="BlogMLAuthor"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");

            //------------------------------------------------------------
            //	Attempt to extract common attributes information
            //------------------------------------------------------------
            if (BlogMLUtility.FillCommonObject(this, source))
            {
                wasLoaded = true;
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication information
            //------------------------------------------------------------
            if (source.HasAttributes)
            {
                string emailAttribute = source.GetAttribute("email", String.Empty);

                if (!String.IsNullOrEmpty(emailAttribute))
                {
                    this.EmailAddress = emailAttribute;
                    wasLoaded         = true;
                }
            }

            return(wasLoaded);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Loads this <see cref="ApmlApplication"/> using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the load operation.</param>
        /// <returns><b>true</b> if the <see cref="ApmlApplication"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="ApmlApplication"/>.
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(settings, "settings");

            //------------------------------------------------------------
            //	Initialize XML namespace resolver
            //------------------------------------------------------------
            XmlNamespaceManager manager = BlogMLUtility.CreateNamespaceManager(source.NameTable);

            //------------------------------------------------------------
            //	Attempt to extract common attributes information
            //------------------------------------------------------------
            if (BlogMLUtility.FillCommonObject(this, source, settings))
            {
                wasLoaded = true;
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication information
            //------------------------------------------------------------
            if (source.HasAttributes)
            {
                string userNameAttribute  = source.GetAttribute("user-name", String.Empty);
                string userEmailAttribute = source.GetAttribute("user-email", String.Empty);
                string userUrlAttribute   = source.GetAttribute("user-url", String.Empty);

                if (!String.IsNullOrEmpty(userNameAttribute))
                {
                    this.UserName = userNameAttribute;
                    wasLoaded     = true;
                }

                if (!String.IsNullOrEmpty(userEmailAttribute))
                {
                    this.UserEmailAddress = userEmailAttribute;
                    wasLoaded             = true;
                }

                if (!String.IsNullOrEmpty(userUrlAttribute))
                {
                    Uri url;
                    if (Uri.TryCreate(userUrlAttribute, UriKind.RelativeOrAbsolute, out url))
                    {
                        this.UserUrl = url;
                        wasLoaded    = true;
                    }
                }
            }

            if (source.HasChildren)
            {
                XPathNavigator contentNavigator = source.SelectSingleNode("blog:content", manager);
                if (contentNavigator != null)
                {
                    BlogMLTextConstruct content = new BlogMLTextConstruct();
                    if (content.Load(contentNavigator))
                    {
                        this.Content = content;
                        wasLoaded    = true;
                    }
                }
            }

            //------------------------------------------------------------
            //	Attempt to extract syndication extension information
            //------------------------------------------------------------
            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(source, settings);

            adapter.Fill(this);

            return(wasLoaded);
        }