How to Use Spry With XML
A Spry set of XML data is made of Javascript and serves as an object that can be used to display data sent from an XML data source. For example, you could use Spry XML data sets to display news information from an XML feed on a website. What makes Spry data sets distinct from others is that it is fundamentally a Javascript object; a number of other programming languages can be used to interact with it.
Instructions
-
-
1
Create a new HTML page in a text editing document or open an existing page.
-
2
Obtain an XML feed or data source, which can be in the form of a Web-based URL or directory path if it's locally stored.
-
-
3
Create a parent node, which we will name "example item" in the XML data for Spry to hook into, for example:
<?xml version="1.0" encoding="UTF-8"?>
<example>
<example_item id="13">
<item>car part>
</example_item>
</example>
-
4
Link the Spry Javascript data set by using the following code and replacing "Spry.Example.Data.XMLSet" with the name of your actual XML file:
<script type="text/javascript">
var datasetName = new Spry.Example.Data.XMLSet("XML_location_here", "name_of_node");
</script>
-
1