XML Data Binding
In flat files, data binding works much the same way as it does with the any recordset. The following code will produce a result almost identical to that shown in Figure 21.3. (It just leaves off the headings.)
<xml id="cats" src="cats.xml"></xml> <table datasrc="#cats" border="1"> <tr> <td><span datafld="name"></span></td> <td><span datafld="age"></span></td> <td><span datafld="color"></span></td> </tr> </table>
Note how the element name is used to bind the data to the HTML element, and how the content of the xml element is treated as the value of the field.
We can bind to input text boxes and all the other elements in the same way. Things get much more complicated, however, when the XML file is not flat. What happens when ...
Get XML Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.