Microdata on tables

Im new for Microdata and the problem with itemscope inside table .

For example, suppose I have a person object in the Im table showing the columns Name, Street, and City.

 <table> <tr itemscope itemtype="http://schema.org/Person"> <td itemprop="name">Name</td> <td itemprop="streetAddress">123 main</td> <td itemprop="addressCountry">USA</td> </tr> </table> 

Note that streetAddress and addressCountry must be children of the address property. However, you cannot add a parent div for grouping in table .

Further it is not visible that the dot notation works, for example. address.streetAddress .

How to support this?

+7
html5 html-table microdata
source share
1 answer

There are pretty ugly solutions to this.

You can use the itemref attribute for the country, but you need to add dummy untyped itemscope so that the addressCountry property addressCountry not added to the Person element:

 <table> <tr itemscope itemtype="http://schema.org/Person"> <td itemprop="name"> Name </td> <td itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" itemref="country"> <span itemprop="streetAddress">123 main</span> </td> <td itemscope> <span itemprop="addressCountry" id="country">USA</span> </td> </tr> </table> 

You can use itemref for just about anything, so you don't need to add dummy itemscope , but the markup becomes more complex and you have to outsource the Person element:

 <meta itemscope itemtype="http://schema.org/Person" itemref="person-name person-address" /> <!-- can't have this as descendant of another Microdata item --> <table> <tr> <td itemprop="name" id="person-name"> Name </td> <td itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" id="person-address" itemref="address-country"> <span itemprop="streetAddress">123 main</span> </td> <td itemprop="addressCountry" id="address-country"> USA </td> </tr> </table> 

Or else Person in table , adding it to the first td :

 <!-- can't have this as descendant of another Microdata item --> <table> <tr> <td itemscope itemtype="http://schema.org/Person" itemref="person-address"> <span itemprop="name">Name</span> </td> <td itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" id="person-address" itemref="address-country"> <span itemprop="streetAddress">123 main</span> </td> <td itemprop="addressCountry" id="address-country"> USA </td> </tr> </table> 
+5
source share