this is my code that has geo-rss from google maps rss:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google AJAX Feed API - Simple Example</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("feeds", "1");
function initialize() {
var feed = new google.feeds.Feed("http://maps.google.com/maps/ms?ie=UTF8&hl=zh-CN&vps=1&jsv=259e&msa=0&output=georss&msid=109685068115364659392.00048b5b630141d82b83a");
feed.load(function(result) {
console.log(result.feed)
});
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body>
<div id="feed"></div>
</body>
</html>
and i can't find the geo data on the firebug ,
so what should i do ..
thanks
updated:
the geo data(in the geo-rss) i want to get is like this:
<georss:point>
39.965015 116.362381
</georss:point>
and
<gml:LineString>
<gml:posList>
39.992191 116.417938
39.968254 116.466698
39.939568 116.451591
39.959045 116.411079
</gml:posList>
</gml:LineString>
this can not get using the google ajax api .
so what should i do ..
You need to load the XML feed instead of the JSON feed to be able to get the raw XML feed as it is. With the JSON feed, it removes all but the standard RSS and Atom tags and then translates to JSON.
Set the result format to XML as
var feed = new google.feeds.Feed("...");
feed.setResultFormat(google.feeds.Feed.XML_FORMAT);
Here is a modified load function to print XML namespaced elements such as georss:point
and gml:LineString
.
feed.load(function(result) {
var georssNS = "http://www.georss.org/georss";
var gmlNS = "http://www.opengis.net/gml";
var items = result.xmlDocument.getElementsByTagName("item");
for(var i = 0; i < items.length; i++) {
// get <georss:point>
var georss = google.feeds.getElementsByTagNameNS(items[i], georssNS, "point")[0];
if(georss) {
console.log(georss)
}
// get <gml:LineString>
var lineString = google.feeds.getElementsByTagNameNS(items[i], gmlNS, "LineString")[0];
if(lineString) {
console.log(lineString);
}
}
});