Re: RDFa Lite API (JavaScript)

Let's take this markup which describes

    Two places 
    with the name "Tsujido" and "Meguro
    and their associated longitude and latitude.


    <ul vocab="http://schema.org/">
        <li typeof="Place">
            <span property="name">Tsujido</span>
            <div property="geo"
                 typeof="GeoCoordinates">
                 <meta property="latitude" content="35.336833"/>
                 <meta property="longitude" content="139.447083"/>
                 </div>
            </li>
        <li typeof="Place">
            <span property="name">Meguro</span>
            <div property="geo"
                 typeof="GeoCoordinates">
                 <meta property="latitude" content="35.633983"/>
                 <meta property="longitude" content="139.71600"/>
                 </div>
            </li>
    </ul>


I would love to be able to do something such as 

    "for each place return the longitude"


    var places = document.getItems('http://schema.org/Place');
    for (var i = places.length - 1; i >= 0; i--) {
       longitude = places[i].properties['longitude']
       console.log(longitude);
    };

And then in the console:

    139.71600
    139.447083


-- 
Karl Dubost - http://dev.opera.com/
Developer Relations, Opera Software

Received on Monday, 10 December 2012 08:00:57 UTC