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

This post is more than 2 years old.

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:

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA