Closed gkellogg closed 6 years ago
Haven't thought about this much, but would declaring "meter" as allowing xsd:integer or xsd:double work?
I am inclined to suggest that processors may convert numerical values to a matching datatype, without obliging them to do so...
SGTM.
p.s. can you talk me through how we handle surface details like "." vs "," e.g.a value of "1,00" vs "1.00"?
I believe HTML 5 addresses valid number syntax: https://www.w3.org/TR/html52/infrastructure.html#numbers, and how they're interpreted.
Since we define the content as strings, we don't have to do any handling. Processors can use whatever information they like to decidce that something is a number - e.g. a page in spanish that has <meter itemprop="rating" value="3,5"><img src="estr.gif"><img src="estr.gif"><img src="estr.gif"><img src="mestr.gif"><img src="estrv.gif"></meter>
provides a value according to the spec of "3,5" as a string. But it is possible for a processor to decide that this is actually the number three-and-a-half. Although it is not required - and incidentally is not valid HTML.
incidentally is not valid HTML.
... I had missed that, and am now reassured.
We explain in the introduction that values are strings or URLs, and again in the algorithm for determining values. I think we can close this without a change to the text...
So, the text in the JSON serialization section is unnecessary, then.
@gkellogg yep. I'll clean it up.
I trimmed some of the language about conversion in #76.
I will add some clarification in various places - while conversions may interpret content to add datatypes, microdata itself treats even dates taken from datetime as a string...
Closing as agreed/fixed above.
The
Values
section discusses getting a value from elements includingdata
andmeter
, but this is returned astextContent
. However, the JSON Serialization section specifically says to serialize JSON using "no unnecessary zero digits in numbers", implying that values may be numbers which could only come from these elements. Certainly the intention of thedata
andmeter
elements is that the content is machine readable and descriptive text in HTML 5.2 does suggest that this is numeric (at least for themeter
element.The Microdata to RDF spec treats this content as numeric if it is either valid
xsd:integer
orxsd:double
, and as text otherwise.