Spry, Apollo, and Remote XML Sources

So this is probably a ‘Duh’ type post, but I was curious how Apollo and it’s “open” web browser would handle remote AJAX requests. As you know (or hopefully know), when doing AJAX requests your browser can only request AJAX data from the same server. So consider a typical Spry dataset:

<script> var dsCharacters = new Spry.Data.XMLDataSet("data.xml","people/person"); </script>

Because of this, you can’t use AJAX to request XML from other servers. So if you wanted to do a RSS feed, you need to point to a ColdFusion file that does the remote hit for you. This is what I do on the ColdFusion Portal.

One thing I’ve been curious about is how Apollo changes this. I know the embedded web browser isn’t locked down like a normal browser, but could it be as simple as providing a full URL to Spry? Yes. This is all I needed to do:

<script> var theFeed = "http://weblogs.macromedia.com/mxna/xml/rss.cfm?query=bySmartCategory&languages=1&smartCategoryId=1&smartCategoryKey=D0382F3A-9D2B-69E8-C7BC317066FA1CC2"; var mxnadata = new Spry.Data.XMLDataSet(theFeed,"/rdf:RDF/item", { useCache: false, loadInterval: 90000 }); </script>

Just so it is clear - I only used 2 lines since the URL I’m testing with is so long. So I copied a bit of code from the Portal, used the command line tools I blogged about before, and was able to quickly build the demo. If you want to see it (and it isn’t really worth the time probably), you can download both the AIR and my original source files below.<p>Download attached file.</p>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate looking for his next gig. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments