Do you have to use a remote source for Spry datasets?

A user on cf-talk today posted about a problem he was having with Spry. He had tested with an XML file, but then he switched to passing an XML string directly to Spry:

<script> var dsTasks = new Spry.Data.XMLDataSet("<cfoutput>#tasks#</cfoutput>","tasks/task"); </script>

This isn't valid. However, there is a way to do this in Spry. Simply create your dataset with a null url:

var dsTasks = new Spry.Data.XMLDataSet(null, "tasks/task");

Then create an XML object out of your string:

var xmlDOMDocument = Spry.Utils.stringToXMLDoc(xmlStr);

Finally, tell the dataset to use your XML object as the data:


A live example of this may be found here:

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.