Page 1 of 1

HML5 and micro data validation

Posted: Thu Dec 26, 2013 8:35 pm
by jpmoularde
Hello!
I'm introducing the "microdata" in my web site, according to http://schema.org/
It consists of adding a few attributes which are interpreted by web search engines, specifically "itemscope", which tells that it's the beginning of a microdata object, "itemtype", which refers to the part of schema.org which defines that object, "itemprop" which gives the name of the corresponding property and "content" which allows to define a standard content for a property, e.g.
<span itemprop="startDate" content="2014-01-01">1st of January 2014</span>

Apparently these attributes are not recognized by the validator used in XML Editor 15.1, build 2013101713

Is there a way to solve that issue?
My html pages are not correctly analysed because these attributes are rejected. Per se it's not a problem, but that behaviour prevents me to see "real" errors, like unclosed tags.

Thanks for your help

Re: HML5 and micro data validation

Posted: Fri Dec 27, 2013 10:54 am
by Radu
Hi Jean-Pierre,

There are two problems with microdata and Oxygen.

1) The microdata specification is mostly for HTML (and not well-formed XHTML) so it has constructs like:

Code: Select all

<div itemscope itemtype ="http://schema.org/Movie">

....


which are not valid XML because the "itemscope" attribute does not have a value.
But this can be fixed:

http://stackoverflow.com/questions/3659778/can-i-add-microdata-from-html5-to-a-xhtml-strict-site-and-still-be-compliant

using the construct like:

Code: Select all

<div itemscope="itemscope" itemtype ="http://schema.org/Movie">

....


2) The schema Oxygen uses to validate XHTML content does not understand the microdata constructs.

I'll add a report on our internal issues list and we'll see if we can do something about this in a future Oxygen version. At least to skip these attributes and validate the rest of the XML content.

Regards,
Radu

Re: HML5 and micro data validation

Posted: Sat Dec 28, 2013 2:55 pm
by jpmoularde
Thanks Radu
When I say "HTML5", I mean XHTML, of course. I hardly understand why people continue using non xml compliant html, even when they establish a new standard! Personally I developed a small HTML generator in php, which takes care of unclosed marks and forces attributes to have a value.
So I had the itemscope="itemscope" issue already fixed in my files.
I hope the schema issue will be fixed soon.

Re: HML5 and micro data validation

Posted: Mon Dec 30, 2013 10:18 am
by Radu
Hi Jean-Pierre,

You can edit the following RNC schema used to provide validation for XHTML 5 when working in Oxygen:

OXYGEN_INSTALL_DIR\frameworks\xhtml\xhtml5 (epub3)\mod\html5\html5-attrib-30.rnc

and add at the end of the file additional attribute definitions for the microdata attributes:

Code: Select all

   ##Microdata extension
   html5.global.common.attrs &= micro.scope.attr? & micro.prop.attr? & micro.type.attr?
   ## Microdata item scope. Identifies the purpose of a certain item.
   micro.scope.attr = attribute itemscope { string }
   ## Microdata item type. Identifies the type of a certain item.
   micro.type.attr = attribute itemtype { string }
   ## Microdata item property. Used to add property labels to an item.
   micro.prop.attr = attribute itemprop { string }


We'll probably add these definitions by default in the RNC which comes with Oxygen 15.2.
Are there any additional microdata attributes which need to be handled similarly?

Regards,
Radu

Re: HML5 and micro data validation

Posted: Sun Jan 05, 2014 6:26 pm
by jpmoularde
Thanks Radu
The trouble is I don't know how to authorize myself to overwrite that file on my PC (windows 7).
It's the first time in years I have to do that, the way to do has apparently changed from the last time I did it under Windows XP, and the documentation is less than easy to understand.
Regard
JP

Re: HML5 and micro data validation

Posted: Mon Jan 06, 2014 10:09 am
by Radu
Hi Jean-Pierre,

As a workaround you can create a folder named frameworks outside of the Program Files location to a place where you have full access rights.
In that folder you should then copy the entire xhtml framework folder from:

OXYGEN_INSTALL_DIR\frameworks\xhtml

Then in that copied folder modify the RNC file from:

xhtml5 (epub3)\mod\html5\html5-attrib-30.rnc

the way I explained in the previous email.

Then from Oxygen in the Preferences->Document Type Association / Locations page add your custom frameworks folder to the Additional frameworks directories list and restart Oxygen. Your custom document type should be used on the next restart.

Regards,
Radu

Re: HML5 and micro data validation

Posted: Mon Jan 06, 2014 11:52 am
by jpmoularde
Thanks, Radu
I'll try it today and keep you informed

Re: HML5 and micro data validation

Posted: Thu Jan 30, 2014 1:09 pm
by jpmoularde
Hello!
I noticed that the latest version of XML Editor includes the "itemprop", "itemscope" and "itemtype" attributes.
But there is still an attribute missing, "content", which allows to give the value of a parameter in a conventional format.
Dates for instance have to be coded in the ISO standard format rather than any of the many human readable formats, as shown below:

Code: Select all

<div class="eventdates">
    From <span itemprop="startDate" content="2014-03-10">10</span>
    through <span itemprop="endDate" content="2014-03-13">13 March 2014</span>
</div>

Re: HML5 and micro data validation

Posted: Thu Jan 30, 2014 1:36 pm
by Radu
Hi,

I'm not sure that the @content attribute should be available on every XHTML 5 element, it seems that it is already present on <meta> tags:

http://html5doctor.com/microdata/#meta

and you can refer to it using @itemref (which we should add to the schema bundled with Oxygen as well along with @itemid).

I cannot find an official specification for Microdata though.

Regards,
Radu

Re: HML5 and micro data validation

Posted: Fri Jan 31, 2014 2:30 pm
by jpmoularde
Hi

Radu wrote:I cannot find an official specification for Microdata though.

To me the "Bible" is http://schema.org and -- you're right -- there doesn't seem to be another way of expressing a date than including it in a <meta> tag.

Re: HML5 and micro data validation

Posted: Fri Jan 31, 2014 3:16 pm
by Radu
Hi,

Thanks for the confirmation.
For the next version of Oxygen I updated the RNC file OXYGEN_INSTALL_DIR\frameworks\xhtml\xhtml5 (epub3)\mod\html5\html5-attrib-30.rnc to recognize the attributes:

Code: Select all

itemscope
itemtype
itemid
itemprop
itemref


If you want to make the changes on your side, the contents of the html5-attrib-30.rnc should be:

Code: Select all

html5.global.attrs &= html5.global.common.attrs & html5.global.xml.attrs & html5.microdata.attrs
html5.i18n.attrs = html5.xml.lang.attr? & html5.lang.attr? & html5.dir.attr?
   
html5.global.xml.attrs &= html5.xml.lang.attr? & html5.xml.base.attr? & html5.xml.space.attr?   
html5.global.common.attrs &= html5.lang.attr? & html5.id.attr? & html5.title.attr? & html5.dir.attr? & html5.class.attr?



html5.lang.attr = attribute lang { datatype.languagecode }
html5.xml.lang.attr = attribute xml:lang { datatype.languagecode }       
html5.dir.attr = attribute dir { 'ltr' | 'rtl' | 'auto' } 
html5.id.attr = attribute id { datatype.ID }   
html5.title.attr = attribute title { string }   
html5.class.attr = attribute class { datatype.html5.space.separated.tokens }   
html5.xml.base.attr = attribute xml:base { datatype.LEIRI }
html5.xml.space.attr = attribute xml:space { 'preserve' | 'default' }

html5.href.attr = attribute href { datatype.html5.URL.spaces }
html5.hreflang.attr = attribute hreflang { datatype.languagecode }     
html5.target.attr = attribute target { datatype.html5.browsing.context.name.or.keyword }
html5.rel.attr = attribute rel { datatype.html5.space.separated.tokens } 
html5.media.attr = attribute media { datatype.html5.media.query }   

html5.type.mime.attr = attribute type { datatype.mimetype }
html5.type.mime.nocharset.attr = attribute type { datatype.mimetype.nocharset }

html5.charset.attr = attribute charset { datatype.character.encoding }

html5.src.attr = attribute src { datatype.html5.URL.spaces }
html5.usemap.attr = attribute usemap {datatype.html5.name.reference}

html5.cite.attr = attribute cite { datatype.html5.URL.spaces }   
html5.alt.attr = attribute alt { datatype.string }

html5.name.context.attr = attribute name { datatype.html5.browsing.context.name }
html5.name.id.attr = attribute name { datatype.html5.name }

html5.dimension.attrs &= html5.width.attr? & html5.height.attr?     
html5.width.attr = attribute width { datatype.non-negative.integer }       
html5.height.attr = attribute height { datatype.non-negative.integer }

##EXM-29190 - Microdata extension
html5.microdata.attrs &= micro.scope.attr? & micro.prop.attr? & micro.type.attr? & micro.itemref.attr? & micro.itemid.attr?
## Microdata item scope. Creates the Item and indicates that descendants of this element contain information about it.
micro.scope.attr = attribute itemscope { string }
## Microdata item type. A valid URL of a vocabulary that describes the item and its properties context.
micro.type.attr = attribute itemtype { string }
## Microdata item property. Indicates that its containing tag holds the value of the specified item property.
micro.prop.attr = attribute itemprop { string }
## Microdata itemref property.  Properties that are not descendants of the element with the itemscope attribute can be associated with the item using this attribute. 
micro.itemref.attr = attribute itemref { string }
## Microdata itemid property. Indicates a unique identifier of the item.
micro.itemid.attr = attribute itemid { string }


Regards,
Radu

Re: HML5 and micro data validation

Posted: Sat Feb 01, 2014 1:05 pm
by jpmoularde
Thanks

By the way, the correct way of coding dates in HTML5 seems to be

Code: Select all

<time datetime="2014-03-13" itemprop="endDate">March 13, 2014</time>

Re: HML5 and micro data validation

Posted: Mon Feb 24, 2014 1:17 am
by jpmoularde
Hello!
It seems that the HTML 5 validator is not in line with specifications on the following items:
  • <meta> tags in <body>
  • "propref" attribute
  • "datetime" attribute in <time>
and maybe some other ones.
Can we expect an update of the validator?

Re: HML5 and micro data validation

Posted: Mon Feb 24, 2014 1:06 pm
by Radu
Hi,

<meta> tags in <body>


I don't see anything in the specs saying that <meta> is allowed in <body>, could you give me a link to that particular reference in the specs?

"propref" attribute


The same, I cannot find anything about the "propref" attribute in the W3C specs.

"datetime" attribute in <time>


A construct like:

Code: Select all

<time datetime="2014-03-13" itemprop="endDate">March 13, 2014</time>


should be valid in Oxygen from what I tested if the XHTML document is interpreted as XHTML 5. Does your document has a DOCTYPE declaration?



Regards,
Radu

Re: HML5 and micro data validation

Posted: Mon Feb 24, 2014 8:26 pm
by jpmoularde
As said above, all items I'm considering in that post are related to microdata

Radu wrote:<meta> tags in <body>
I don't see anything in the specs saying that <meta> is allowed in <body>, could you give me a link to that particular reference in the specs?

see http://www.whatwg.org/specs/web-apps/cu ... ta-element
It says that <meta> tags containing an "itemprop" attribute are allowed in "flow content" and "phrasing content", i.e. anywhere in the <body>

Radu wrote:"propref" attribute
The same, I cannot find anything about the "propref" attribute in the W3C specs.

see http://www.w3.org/TR/2011/WD-microdata-20110525/
That attribute is used to refer to a part of the HTML file which is not included in the current parameter set, for instance:

Code: Select all

<div id="Monteverdi" itemprop="author" itemscope="itemscope" itemtype="http //schema.org/Person">...</div>
...
...
<div itemscope="itemscope" itemtype="http://schema.org/CreativeWork" itemref="Monteverdi">...</div>

which means that the <div> with 'id="Monteverdi"' refers to the author of the work described later.

Radu wrote:"datetime" attribute in <time>
A construct like:

Code: Select all

<time datetime="2014-03-13" itemprop="endDate">March 13, 2014</time>

should be valid in Oxygen from what I tested if the XHTML document is interpreted as XHTML 5. Does your document has a DOCTYPE declaration?

see http://dev.w3.org/html5/markup/time.html
Yes, my document contains a DOCTYPE declaration, but if

Code: Select all

<time datetime="2014-03-13" itemprop="endDate">March 13, 2014</time>

is accepted, another expression like

Code: Select all

<time datetime="2014-03" itemprop="datePubllished">March 2014</time>

is not accepted.
I know that the standard has been modified several times; <time> has even been deleted from the documents for some time, but -- as much as I know -- it has been reintroduced about 2 years ago with a lot of extensions.
see: http://www.webmonkey.com/2012/02/the-ht ... than-ever/

Regards
JP

Re: HML5 and micro data validation

Posted: Tue Feb 25, 2014 10:29 am
by Radu
Hi,

1) According to the specs the <meta> element is not accepted as flow content:

http://www.w3.org/html/wg/drafts/html/master/dom.html#flow-content-1

2) There is no propref attribute, I think you mean itemref which will be recognized as an attribute in Oxygen 16. I already gave you in a reply above what changes to make to the html5-attrib-30.rnc in order for itemref to be recognized.

3) About the time datetime allowed patterns, I think you are right, it should also allow patterns like "2014-03" the specs:

http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html#attr-time-datetime

We'll see if we can rectify this on our side in the XHTML 5 schemas.

Regards,
Radu

Re: HML5 and micro data validation

Posted: Tue Feb 25, 2014 8:55 pm
by jpmoularde
Radu wrote:1) According to the specs the <meta> element is not accepted as flow content:
http://www.w3.org/html/wg/drafts/html/master/dom.html#flow-content-1

It's not what I read in that very document:
3.2.4.1.2 Flow content

Most elements that are used in the body of documents and applications are categorized as flow content.

a
abbr
.......
link (if the itemprop attribute is present)
.......
meta (if the itemprop attribute is present)

So if there is an "itemprop" attribute, a <meta> tag can be included in the <body>.

Radu wrote:2) There is no propref attribute, I think you mean itemref which will be recognized as an attribute in Oxygen 16. I already gave you in a reply above what changes to make to the html5-attrib-30.rnc in order for itemref to be recognized.

You're right, my mistake!
Radu wrote:3) About the time datetime allowed patterns, I think you are right, it should also allow patterns like "2014-03" the specs:

http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html#attr-time-datetime

We'll see if we can rectify this on our side in the XHTML 5 schemas.


Thanks

Re: HML5 and micro data validation

Posted: Wed Feb 26, 2014 5:04 pm
by Radu
Hi,

You are right about the remark:

meta (if the itemprop attribute is present)


We'll see if we can make some changes to the schemas used for HTML 5 validation to accommodate this as well.

Regards,
Radu

Re: HML5 and micro data validation

Posted: Wed Feb 26, 2014 8:33 pm
by jpmoularde
Thanks
It's not very important, as most of my web pages are generated by a program in php which of course does not submit the result. But for the few handwritten html files I have, I prefer checking their validity first. As the validator stops at the firs "error" it encounters", the less "false errors" there is, the best it is.
Regards
JP

Re: HML5 and micro data validation

Posted: Thu Feb 27, 2014 9:59 am
by Radu
Hi,

Probably depends on the case but usually validation should not stop at the first reported problem (unless it is considered to be fatal in some way).
If you have a precise case in which validation stops at the first problem, just give us a small sample and we'll see if we can improve this behavior.

Regards,
Radu

Re: HML5 and micro data validation

Posted: Wed Mar 12, 2014 2:25 pm
by jpmoularde
Hi Radu!

It does not really stop, you're right: there is that series if red bars in the rightmost part of the window that shows lines where errors have been found, so there can be a large number of errors found in one shot.
Thanks for drawing my attention on that point, it will save me time.
Regards
JP