04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3: Working with <strong>Spry</strong> XML Data<br />

Sets<br />

A <strong>Spry</strong> XML Data Set is a JavaScript object that you can use to display data from an XML data source file on a web<br />

page. You can then use this data to create master and detail regions on the page that update as site visitors make<br />

different selections.<br />

About <strong>Spry</strong> XML Data Sets and dynamic regions<br />

<strong>Spry</strong> XML Data Set basic overview<br />

A <strong>Spry</strong> data set is fundamentally a JavaScript object. With a few snippets of code in your web page, you can create<br />

this object and load data from an XML source into the object when the user opens the page in a browser. The data<br />

set results in a flattened array of XML data that can be represented as a standard table containing rows and columns.<br />

For example, suppose you have an XML source file, cafetownsend.xml, that contains the following information:<br />

<br />

<br />

<br />

Summer Salad<br />

organic butter lettuce with apples, blood oranges, gorgonzola, and<br />

raspberry vinaigrette.<br />

7<br />

<br />

<br />

Thai Noodle Salad<br />

lightly sauteed in sesame oil with baby bok choi, portobello mushrooms,<br />

and scallions.<br />

8<br />

<br />

<br />

Grilled Pacific Salmon<br />

served with new potatoes, diced beets, Italian parlsey, and lemon<br />

zest.<br />

16<br />

<br />

<br />

Using XPath in your web page to indicate the data you’re interested in (in this example, the specials/menu_item node<br />

of the XML file), the data set flattens the XML data into an array of objects (rows) and properties (columns), represented<br />

by the following table.<br />

91

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!