Spry

XML overview

XML stands for eXtensible Markup Language, and provides a flexible yet strict method for storing and transmitting data. The language is flexible in that you can create format and node names in any way; it’s strict in that XML follows a strict set of rules for its structure, requiring closing tags for all elements, and observing rules for case sensitivity.

XML is essentially a tree-like structure of nodes and nested nodes that contain information. As the author of the XML, you can define the names of the nodes.

A basic XML file looks something like this:

<?xml version="1.0" encoding="utf-8"?>
   <employees xmlns="http://www.foo.com/employees">
     <employee id="120585">
       <lastname>Jones</lastname>
       <firstname>John</firstname>
       <phone>(415) 333-9345 </phone>
       <username>jjones</username>
    </employee>
    <employee id="127493">
       <lastname>Brown</lastname>
       <firstname>Joe</firstname>
       <phone>(415) 333-5938 </phone>
       <username>jbrown</username>
    </employee>
  </employees>

The first line is the XML declaration. It specifies the version of the XML and the encoding of the document. The encoding tells the browser what character set the XML is using.

In the example, employees is the top-level node of the XML. This node defines the start of the specified content. All node tags must have a closing tag. In the example, the last line of the XML file has a closing employees tag that corresponds to the opening tag of the top-level employees node.

Within the employees node is a repeating employee node that also contains opening and closing tags. This is where the file stores the bulk of the actual data. You can assign any names to these node, but remember that node names are case sensitive. When you use a Spry data reference to display the data in a Spry region, if the node in your XML file is employee, the data reference on the HTML page must be {employee}. If the node is Employee, the data reference on the HTML page needs to be {Employee}, and so on. When the case of a node in the XML file does not match the case of the corresponding data reference on the HTML page, the XML file cannot deliver the data, and Spry will return an error message.