HTML Validation Error for Property Attribute

Html validation error for property attribute

Facebook's plugins use Open Graph, which is built on RDFa. It's RDFa that adds the property attribute to elements. Without this addition, plain HTML has no such attribute. (If you ask me, it's a strange design to add a new attribute without namespacing it, and to re-use half of a <meta> tag. But no-one did.)

To validate XHTML-with-RDFa, you'll need the DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

This means you will have to be writing valid XHTML 1.1. More

Property-level validation errors hinder the validation of Class-level validation

This isn't supported. If any of the property level validations fail, then the class level validations are not performed. I suggest you look at MVC Foolproof Validation. It extends MVC validation to add support for contingent property validation. I think that would solve the problem for this particular case.

The project site states that it doesn't work with the MVC2 RC, so you'll have to download the source code and get it running/adopt their ideas yourself.

Validation error: The itemprop attribute was specified, but the element is not a property of any item

You should explicitly provide a type these properties (name, description, image) belong to.

In Schema.org, everything is a Thing. Thing has many child types, listed under "More specific Types". Start there and choose the most specific type for your content.

For example: WebPage, Article or maybe BlogPosting.

It could look like (using WebPage as example here):

<html itemscope itemtype="http://schema.org/WebPage">

Onmouseenter validation error

Your code is perfectly valid. The spec clearly states that onmouseenter is a valid event handler on all HTML elements in HTML5. There is no change in the HTML 5.1 spec at the present time.

Substituting onmouseover produces no errors in the validator, leading me to believe this is merely a bug on their end. This bug does not appear to have been reported, so I would recommend filing one.

HTML validation errors using Facebook RDFa doctype & meta property

The "name" attribute in XHTML has been deprecated in favor of the "id" attribute for the map tag.

Validation issue with Microdata: The itemprop attribute was specified, but the element is not a property of any item.

Each property (itemprop) has to belong to an item (itemscope). The error message tells you that you have a property for which that is not the case.

It seems that your mainEntity property does not belong to an item. You probably want to use WebPage:

<html itemscope itemtype="http://schema.org/WebPage" lang="en">
<head>
<title>…</title>
</head>
<body>
<article itemprop="mainEntity" itemscope itemtype="http://schema.org/Article">
</article>
</body>
</html>

As the mainEntity has an inverse property, mainEntityOfPage, you could also use a different structure, which would make sense if you don’t have any other properties for WebPage:

<html itemscope itemtype="http://schema.org/Article" lang="en">
<head>
<title>…</title>
<link itemprop="mainEntityOfPage" href="the-URL-of-your-page" />
</head>
<body>
</body>
</html>

W3C validator shows new error: Meta requires 'name' attribute

For HTML5

If a meta element has the property attribute (from RDFa), the name attribute is not required.

See the section "Extensions to the HTML5 Syntax" from the W3C Recommendation HTML+RDFa 1.1 - Second Edition:

If the RDFa @property attribute is present on the meta element, neither the @name, @http-equiv, nor @charset attributes are required and the @content attribute MUST be specified.

So your markup is fine:

<meta property="og:site_name" content="--Sitename--" />

But it’s (now) even valid if you use the name attribute instead of RDFa’s property, because the OGP values are registered. So this is fine, too:

<meta name="og:site_name" content="--Sitename--" />

And you could even combine both ways:

<meta name="og:site_name" property="og:site_name" content="--Sitename--" />

Meta tag 'there is no attribute property ' and other attribute error:

The attributes you mention are simply not part of XHTML 1.0 Transitional, so a validator has to report them as errors. Just remember that the concept of error is relative here: it means that the document does not conform to the document type definition it purports to comply with (by referring to a document type definition by the doctype declaration).

The property attribute is not part of HTML5 CR either, but validators like http://validator.nu use a “schema for HTML5 + SVG 1.1 + MathML 3.0 + RDFa Lite 1.1”, where the RDFa part allows property.

If your markup is a mix of XHTML 1.0 Transitional and HTML5, for example, just relax. The mix works in browsers and other relevant software, except for validators, which need to be picky. Just use a doctype that best corresponds to the markup you have, and manually check the error messages. If you get just 3 error messages when using XHTML 1.0 Transitional, keep using it, until you get fewer errors when checking against HTML5.

How can I change the error message for implicitly required properties in a view model?

You right, your problem is that your property is not nullable. For not nullable properties attribute Required is meaningless. When there is no StartDate value, validation is not go to your Required attribute and fails on previous step. If you want to get your ErrorMessage you should
use:

[Required(ErrorMessage = "The Date field is required for Start.")]
[Display(Name = "Start")]
public DateTime? DateStart { get; set; }

You cannot customize ErrorMessage for nonullable types that get null on modelbinding, cause it is hardcoded deep in MVC framework.

Confused with HTML validation error

You don't need to write "px" with width or height property of img

The width attribute specifies the width of an image, in pixels.

just write something like this

<img src="Media//Service//rightImage.jpg" alt="Watch Repair" width="380" height="272" style="float:right;" />

and the preferred way is to use style property to define these properties

<img src="Media//Service//rightImage.jpg" alt="Watch Repair" style="width:380px;height:272px;float:right;" />


Related Topics



Leave a reply



Submit