/// <summary>
        /// Main Content parsing method.
        /// </summary>
        /// <param name="parent">Parent stack for current node.</param>
        /// <param name="reader">Current xml feed reader.</param>
        /// <param name="feed">Current feed result.</param>
        /// <param name="root">Flag indicating if parser is the default root parser.</param>
        /// <returns>Flag indicating if current node should be parsed or if next node should be retrieved.</returns>
        public override async Task <bool> Parse(Stack <NodeInformation> parent, XmlReader reader, Feed feed, bool root = true)
        {
            //Init
            bool result;

            //Verify Element Node
            if (result = reader.NodeType == XmlNodeType.Element && (!reader.IsEmptyElement || reader.HasAttributes))
            {
                //Init
                NodeInformation nodeInfo = reader.NodeInformation();

                //Add Content to feed content type.
                ICommonFeed feedTarget = feed.CurrentItem ?? (ICommonFeed)feed;
                feedTarget.ContentType |= FeedContentType.Content;

                //Set common feed target
                ICommonContent target = feed.CurrentItem ?? (ICommonContent)feed;

                //Identify node name
                switch (reader.LocalName)
                {
                    #region Common

                case "encoded":     //Contains the complete encoded content of the feed/item.
                {
                    //Attemp to get encoded content
                    target.Content = new FeedContent()
                    {
                        Type = "text/html"
                    };
                    target.Content.Text = await reader.ReadStartElementAndContentAsStringAsync(target.Content.Type).ConfigureAwait(false);

                    break;
                }

                    #endregion Common

                default:     //Unknown feed/item node, continue to next.
                {
                    result = false;
                    if (root)
                    {
                        SetParseError(ParseErrorType.UnknownNode, nodeInfo, feed);
                    }
                    break;
                }
                }
            }

            //Return result
            return(result);
        }
Beispiel #2
0
 public static string GetSmallHeaderText(ICommonContent that) => that.Value <string>("smallHeaderText");
Beispiel #3
0
 public static global::Umbraco.Web.Models.Link GetLink(ICommonContent that) => that.Value <global::Umbraco.Web.Models.Link>("link");
Beispiel #4
0
 public static string GetLargeSubHeaderText(ICommonContent that) => that.Value <string>("largeSubHeaderText");
Beispiel #5
0
 public static global::Umbraco.Core.Models.PublishedContent.IPublishedContent GetImage(ICommonContent that) => that.Value <global::Umbraco.Core.Models.PublishedContent.IPublishedContent>("image");
Beispiel #6
0
 public static string GetDescription(ICommonContent that) => that.Value <string>("description");