Пример #1
0
        /// <summary>
        /// Enters the element described by <paramref name="token"/>.
        /// </summary>
        /// <param name="token">
        /// The token describing the element.
        /// </param>
        public void EnterElement(FragmentToken token)
        {
            if (this.elements.Any())
            {
                this.Element.HasContent    = true;
                this.Element.InlineContent = false;
            }

            var details = (ElementTokenDetails)token.Content;
            var element = new ElementInfo(token.Name, this.Element.Depth + 1)
            {
                PreserveSpace =
                    details.Space == XmlSpace.Preserve ||
                    details.Space == XmlSpace.None && this.Element.PreserveSpace,
                AttributeCount = details.AttributeCount,
            };

            this.elements.Push(element);
            this.LocalDepth = 0;
        }
Пример #2
0
        /// <summary>
        /// Creates an attribute token from a <see cref="XmlReader"/> that assigns Name and Value.
        /// </summary>
        /// <param name="reader">
        /// The reader.
        /// </param>
        /// <returns>
        /// The newly created <see cref="FragmentToken"/>.
        /// </returns>
        private FragmentToken CreateCommentToken(XmlReader reader)
        {
            var token = new FragmentToken(reader.NodeType.ToFragmentType(), reader.Name, reader.Value);

            var clean = token.ContentString.Trim();

            if (!clean.StartsWith("xamlr:order"))
            {
                return(token);
            }

            clean = clean.Remove(0, "xamlr:order".Length).Trim();
            var parts = clean.Split(',').Select(item => item.Trim()).ToArray();

            if (parts.Length < 2)
            {
                return(token);
            }

            this.attributeOrderOverride.Clear();
            this.attributeOrderOverride.AddRange(parts);

            return(token);
        }