Spry data sets

In the Spry framework, a data set requests information from a file or web service, and stores the response for display by other Spry components.

The data set is Spry’s implementation of the Ajax technique.

About Spry data sets

A Spry data set is fundamentally a JavaScript object. With a few lines of code in your web page, you can create this object and load data from a data source (such as an XML file, HTML file, or JSON file) into the object. The data set results in an array of data in the form of a standard table containing rows and columns.

After you create a data set, you can specify how you want to display the data on a web page by using Spry regions.

Spry creates each kind of data set slightly differently. For example, when you create an XML data set, it is important that you specify the correct XPath when creating the data set. When you create an HTML data set, you don’t use XPath, but rather an ID that identifies the HTML element that contains the data to extract. Regardless of the type of data set you create, Spry attributes and data references work the same way.

You can think of a data set as a virtual holding container whose structure is rows and columns. It exists as a JavaScript object whose information is only visible when you specify exactly how to display it on the web page. You can display all of the data in this holding container, or you might choose to display only selected pieces of it.

Source: adobe.com

Spry Data Sets and XML

Keep the following important points in mind when using XML as a data source:

  • XML nodes are case sensitive.
  • Valid XML displays properly in browsers. If it works properly in a browser, it should work properly for Spry.
  • You must wrap special characters in CDATA.
  • You must deliver XML documents as text/xml or application/xml documents.
  • The encoding declared in the XML source file should be the same as the encoding for the HTML page.
  • The XML source must reside on the same domain as the Spry page.
  • The XML can come from an XML file or a dynamic page that generates XML.

About XML @ adobe.com

Example: data set and repeat list

Advanced example: Accordion with Spry data set

The link below shows an advanced Spry example, using an Accordion to display a Spry data set.

Spry Resources