示例#1
0
        /// <summary>
        /// Loops through children of an <see cref="INode"/> and appends as <see cref="Inline"/> to given <see cref="InlineCollection"/>.
        /// </summary>
        /// <param name="node">The parent <see cref="INode"/>.</param>
        /// <param name="inlines">The <see cref="InlineCollection"/> collection to add inlines to.</param>
        protected void AddInlineChildren(INode node, InlineCollection inlines)
        {
            bool isInDiv = false;

            if (node.NodeName == "DIV")
            {
                isInDiv = true;
            }
            if (isInDiv)
            {
                inlines.Add(new LineBreak());
            }
            foreach (var child in node.ChildNodes)
            {
                var inline = GenerateInlineForNode(child, inlines);

                try
                {
                    if (inlines.LastOrDefault() != inline)
                    {
                        inlines.Add(inline);
                    }
                }
                catch (ArgumentException exception)
                {
                    System.Diagnostics.Debug.WriteLine(exception.Message);
                }
            }
            if (isInDiv)
            {
                inlines.Add(new LineBreak());
            }
        }
        /// <summary>
        /// Loops through children of an <see cref="INode"/> and appends as <see cref="Inline"/> to given <see cref="InlineCollection"/>.
        /// </summary>
        /// <param name="node">The parent <see cref="INode"/>.</param>
        /// <param name="inlines">The <see cref="InlineCollection"/> collection to add inlines to.</param>
        protected void AddInlineChildren(INode node, InlineCollection inlines)
        {
            foreach (var child in node.ChildNodes)
            {
                var inline = GenerateInlineForNode(child, inlines);

                if (inlines.LastOrDefault() != inline)
                {
                    inlines.Add(inline);
                }
            }
        }