Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HtmlTagToken"/> class.
        /// </summary>
        /// <remarks>
        /// Creates a new <see cref="HtmlTagToken"/>.
        /// </remarks>
        /// <param name="name">The name of the tag.</param>
        /// <param name="isEndTag"><c>true</c> if the tag is an end tag; otherwise, <c>false</c>.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="name"/> is <c>null</c>.
        /// </exception>
        public HtmlTagToken(string name, bool isEndTag) : base(HtmlTokenKind.Tag)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            Attributes = new HtmlAttributeCollection();
            Id         = name.ToHtmlTagId();
            IsEndTag   = isEndTag;
            Name       = name;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HtmlTagToken"/> class.
        /// </summary>
        /// <remarks>
        /// Creates a new <see cref="HtmlTagToken"/>.
        /// </remarks>
        /// <param name="name">The name of the tag.</param>
        /// <param name="attributes">The attributes.</param>
        /// <param name="isEmptyElement"><c>true</c> if the tag is an empty element; otherwise, <c>false</c>.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="name"/> is <c>null</c>.</para>
        /// <para>-or-</para>
        /// <para><paramref name="attributes"/> is <c>null</c>.</para>
        /// </exception>
        public HtmlTagToken(string name, IEnumerable <HtmlAttribute> attributes, bool isEmptyElement) : base(HtmlTokenKind.Tag)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            Attributes     = new HtmlAttributeCollection(attributes);
            IsEmptyElement = isEmptyElement;
            Id             = name.ToHtmlTagId();
            Name           = name;
        }