287
edits
(Add datasource info) |
No edit summary |
||
| Line 429: | Line 429: | ||
The datasource element will look up a datasource loader of the given type (in the example "xml"), probably by appending the type to a contract id as rdf: datasources are currently done. This will retrieve the datasource from the src attribute and supply it to the template builder. Multiple templates may refer to the same <datasource> element; in this case the source is only loaded once and shared by all templates that refer to it. | The datasource element will look up a datasource loader of the given type (in the example "xml"), probably by appending the type to a contract id as rdf: datasources are currently done. This will retrieve the datasource from the src attribute and supply it to the template builder. Multiple templates may refer to the same <datasource> element; in this case the source is only loaded once and shared by all templates that refer to it. | ||
If there is no src attribute, the tag itself it used as the xml datasource. | |||
An error event (onerror) may be used for error handling. Other attributes on the <datasource> tag may be used for datasource-specific purposes. | An error event (onerror) may be used for error handling. Other attributes on the <datasource> tag may be used for datasource-specific purposes. | ||
| Line 435: | Line 437: | ||
Here is an example for generating XML, assuming some simple query | Here is an example for generating XML, assuming some simple query | ||
syntax. | syntax. (note: people should be a different namespace -- there will be issues here) | ||
< | <datasource id="data" type="xml"> | ||
< | <people> | ||
<person name="Fred" gender="male"/> | |||
</ | <person name="Sarah" gender="female"/> | ||
</people> | |||
</datasource> | |||
<listbox datasources="#data"> | <listbox datasources="#data"> | ||
<template> | <template> | ||
edits