Pages

Wednesday, June 6, 2012

ArcGIS API for JavaScript Tips-n-Tricks: Parsing GeoRSS with jQuery


There are quite a few reasons why GeoRSS feeds can be tricky to parse. The reasons include confusing child-parent tag relationships, and some parsers simply don’t work with namespaces (e.g. ) depending on which browser you are using. This is where jQuery comes in very handy, especially if you want your app to function well across the major browsers. The pattern that you can use looks like this:


//Look for the tag  
$(data).find(“[nodeName='geo:lat']“).text()

Feel free to click here to see a live example and view the source code. Or just download the source and try it out on your machine.

References:
http://api.jquery.com/find/ 
http://api.jquery.com/jQuery.ajax/ 
http://docs.jquery.com/Tutorials:How_to_Get_Anything_You_Want

No comments:

Post a Comment