W3C home > Mailing lists > Public > www-validator@w3.org > August 2013

Re: Itemscope validation

From: Michael[tm] Smith <mike@w3.org>
Date: Mon, 19 Aug 2013 10:21:16 +0900
To: Andry Rendy <master.skywalker.88@gmail.com>
Cc: www-validator@w3.org
Message-ID: <20130819012114.GE460@sideshowbarker>
Andry Rendy <master.skywalker.88@gmail.com>, 2013-08-18 21:40 +0200:

> Greetings to the Validator.nu staff.
> I just tried a validation via direct input on the "validator.w3.org/nu"
> feature. My interest was to check the behavior of the service against the
> "itemscope/itemprop/property" scheme.

"itemscope" and "itemprop" are attributes from Microdata, while "property"
is from RDFa. There is no specification that defines what the validation
requirements are when you mix Microdata attributes with RDFa attributes on
the same element, and validator doesn't expect that you will, and doesn't
support mixing Microdata and RDFa them on the same element.

> As of yet I don't know Schema.org
> specification well enough but I have found an erratic behavior. It seems
> that the validator considers correct the @itemprop and @property if they
> are used in alternate elements. Below the full document i validated first:
> 
> <html itemscope itemtype="http://schema.org/WebPage" xmlns:fb="
> https://www.facebook.com/2008/fbml">
>   <head>
>     <title>An Example Title</title>
>     <meta content="An Example Title" itemprop="name" property="og:title" />

The solution is to not use "itemprop" and  property on the same element.

> ...
> Based on the errors presented by the validator I tried this version of the
> same document:
> 
> <!DOCTYPE html>
> <html itemscope itemtype="http://schema.org/WebPage" xmlns="
> http://www.w3.org/1999/xhtml">
>   <head>
>     <title>An Example Title</title>
>     <meta itemprop="name" content="An Example Title" />
>     <meta name="description" property="og:description" content="Lorem ipsum dolor sit amet" />
>     <meta itemprop="image" content="http://www.example.com/image.jpg" />
>     <link rel="canonical" property="og:url" href="http://www.example.com/permalink" />
> ...

That looks fine and should validate fine because you're not using
"itemprop" and "property" on the same element.

> The latter results correct. But, basing on the Schema.org semantic metadata
> specification, each semantic element should possess the "itemprop/property"
> attributes pair.

What "Schema.org semantic metadata specification"? Do you have a URL?

When I look through the schema.org docs for RDFa-related info, I find this:

  http://schema.org/docs/datamodel.html

...with an RDFa example that uses "property" without "itemprop" and which
says "itemprop is replaced property" -- and that doesn't show or suggest
that "itemprop" and "property" should be used together.

> Can you explain the error or fix the bug, if any?

What you're seeing is expected behavior. Microdata and RDFa are separate
specifications that define different attributes you can add to HTML
documents, and there's no separate specification that defines what the
validation requirements are when you mix Microdata and RDFa attributes on
the same element. So you shouldn't mix them.

> Also, notice that in the first version of the document the attribute
> xmlns:fb="https://www.facebook.com/2008/fbml" is present. The validation
> result states that it is both not allowed and not serializable due to its
> local name. Is this correct?

Yes. In HTML documents, don't use "xmlns:fb". HTML parsers (and browsers)
don't process "xmlns:" attributes -- only XML parsers do.

> Shouldn't HTML5 allow namespace-specific attributes via prefix?

If you want to have prefixed attribute values in RDFa, use the RDFa
"prefix" attribute to declare the prefixes (instead of "xmlns:").

  --Mike

-- 
Michael[tm] Smith http://people.w3.org/mike
Received on Monday, 19 August 2013 01:21:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:09 UTC