HML5 and micro data validation
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
HML5 and micro data validation
Post by jpmoularde »
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
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
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">
....
But this can be fixed:
http://stackoverflow.com/questions/3659 ... -compliant
using the construct like:
Code: Select all
<div itemscope="itemscope" itemtype ="http://schema.org/Movie">
....
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
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
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 }
Are there any additional microdata attributes which need to be handled similarly?
Regards,
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
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
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
I'll try it today and keep you informed
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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>
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
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
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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.Radu wrote:I cannot find an official specification for Microdata though.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
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
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 }
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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>
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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>
Can we expect an update of the validator?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
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?<meta> tags in <body>
The same, I cannot find anything about the "propref" attribute in the W3C specs."propref" attribute
A construct like:"datetime" attribute in <time>
Code: Select all
<time datetime="2014-03-13" itemprop="endDate">March 13, 2014</time>
Regards,
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
see http://www.whatwg.org/specs/web-apps/cu ... ta-elementRadu 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?
It says that <meta> tags containing an "itemprop" attribute are allowed in "flow content" and "phrasing content", i.e. anywhere in the <body>
see http://www.w3.org/TR/2011/WD-microdata-20110525/Radu wrote: "propref" attribute
The same, I cannot find anything about the "propref" attribute in the W3C specs.
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>
see http://dev.w3.org/html5/markup/time.htmlRadu wrote:"datetime" attribute in <time>
A construct like: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?Code: Select all
<time datetime="2014-03-13" itemprop="endDate">March 13, 2014</time>
Yes, my document contains a DOCTYPE declaration, but if
Code: Select all
<time datetime="2014-03-13" itemprop="endDate">March 13, 2014</time>
Code: Select all
<time datetime="2014-03" itemprop="datePubllished">March 2014</time>
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
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
1) According to the specs the <meta> element is not accepted as flow content:
http://www.w3.org/html/wg/drafts/html/m ... -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/m ... e-datetime
We'll see if we can rectify this on our side in the XHTML 5 schemas.
Regards,
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
It's not what I read in that very document:Radu wrote: 1) According to the specs the <meta> element is not accepted as flow content:
http://www.w3.org/html/wg/drafts/html/m ... -content-1
So if there is an "itemprop" attribute, a <meta> tag can be included in the <body>.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)
You're right, my mistake!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.
ThanksRadu 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/m ... e-datetime
We'll see if we can rectify this on our side in the XHTML 5 schemas.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
You are right about the remark:
We'll see if we can make some changes to the schemas used for HTML 5 validation to accommodate this as well.meta (if the itemprop attribute is present)
Regards,
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: HML5 and micro data validation
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
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Dec 16, 2009 2:53 pm
Re: HML5 and micro data validation
Post by jpmoularde »
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
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service