Beispiel #1
0
        /// <summary>Validates an element.</summary>
        /// <param name="element">The element.</param>
        /// <returns>True if element is valid otherwise false.</returns>
        public bool Validate(BaseHtmlElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            return(string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase) &&
                   string.Equals(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName, StringComparison.InvariantCultureIgnoreCase));
        }
Beispiel #2
0
        /// <summary>Validates an element.</summary>
        /// <param name="element">The element.</param>
        /// <returns>True if element is valid otherwise false.</returns>
        public bool Validate(BaseHtmlElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            return string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase)
                   && string.Equals(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName, StringComparison.InvariantCultureIgnoreCase);
        }
Beispiel #3
0
        /// <summary>Gets an error message for an invalid element.</summary>
        /// <param name="element">The invalid element.</param>
        /// <returns>The error message.</returns>
        public string GetErrorMessage(BaseHtmlElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            return string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase)
                       ? @"The attribute 'type=""{0}""' does not match to 'type=""{1}""'".F(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName)
                       : "'{0}' tag does not match to '{1}' tag".F(element.TagName, HtmlElements.Input);
        }
Beispiel #4
0
        /// <summary>Gets an error message for an invalid element.</summary>
        /// <param name="element">The invalid element.</param>
        /// <returns>The error message.</returns>
        public string GetErrorMessage(BaseHtmlElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            return(string.Equals(element.TagName, HtmlElements.Input, StringComparison.InvariantCultureIgnoreCase)
                       ? @"The attribute 'type=""{0}""' does not match to 'type=""{1}""'".F(element.GetAttributeValue(HtmlElementAttributes.Type), this.typeName)
                       : "'{0}' tag does not match to '{1}' tag".F(element.TagName, HtmlElements.Input));
        }