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.

<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 />

5 To create the data set, insert the following script block after the script tags importing the library:<br />

<br />

var datasetName = new <strong>Spry</strong>.Data.XMLDataSet("XMLsource", "XPathToRepeatingChildNode");<br />

<br />

In the Cafe Townsend example, you create a data set with the following statement:<br />

var dsSpecials = new <strong>Spry</strong>.Data.XMLDataSet("data/cafetownsend.xml", "specials/menu_item");<br />

The statement creates a new data set called dsSpecials that retrieves data from the specials/menu_item node in<br />

the specified XML file. The data set has a row for each menu item and the following columns: @id, item, description,<br />

and price that the following table represents.<br />

@id item description price<br />

1 Summer salad organic butter lettuce with apples, blood<br />

oranges, gorgonzola, and raspberry vinaigrette.<br />

2 Thai Noodle Salad lightly sauteed in sesame oil with baby bok<br />

choi, portobello mushrooms, and scallions.<br />

3 Grilled Pacific Salmon served with new potatoes, diced beets,<br />

Italian parlsey, and lemon zest.<br />

You can also specify a URL as the source of the XML data, as follows:<br />

var dsSpecials = new<br />

<strong>Spry</strong>.Data.XMLDataSet("http://www.somesite.com/somefolder/cafetownsend.xml",<br />

"specials/menu_item");<br />

SPRY<br />

<strong>User</strong> <strong>Guide</strong><br />

Note: The URL you decide to use (whether absolute or relative) is subject to the browser’s security model, which means<br />

that you can only load data from an XML source that is on the same server domain as the HTML page you’re linking<br />

from. You can avoid this by providing a cross-domain service script. For more information, consult your server administrator.<br />

7<br />

8<br />

16<br />

112

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

Saved successfully!

Ooh no, something went wrong!