Fields,
Records and Recordsets
IE 5.0 and above allows you to use XML as a data source that you can
bind to a Web document. It's easiest to think of a data source as a
collection of records, or recordset, with each record consisting of
atomic data elements, known as fields or attributes that describe the
record, which is very similar to how you would organize data in a database.
A recordset may be simple or hierarchical:
Simple:
<group>
<person>
<first>Joe</first>
<last>Smith</last>
</person>
<person>
<first>Mary</first>
<last>Doe</last>
</person>
</group>
|
Hierarchical:
<group>
<department>
<deptname>CIS</deptname>
<person>
<first>Mark</first>
<last>Jones</last>
</person>
<person>
<first>Jane</first>
<last>Doe</last>
</person>
</department>
<department>.....</department>
</group>
|
There is no limit to the number of nested recordsets a document may
contain. It is important to know whether your data source is simple
or hiercharchical because IE uses a different data binding technique
for each.
Data Islands
When you bind a Web page to a recordset, the attached data is known
as a data island, which can be either external or embedded. Binding
data by embedding the XML into the HTML document generally is not very
useful because it defeats the purpose of separating content from formatting.
Use the following syntax to create a data island from an external file:
<xml id="id" src="URL"></xml>
When IE creates the data island, the parser reads and stores the daa
island as a data source object (DSO). The DSO handls the interaction
between the Web page and the data island. In advanced applications,
you can use a program to control the actions of the DSO, such as specifying
which records to display when. Keep in mind if the document is not well-formed
or valid, IE will ignore the DSO and won't give you a reason for the
error. It is also important to understand that the DSO is created only
one time per session, so if the contents of the data source are changed,
you need to refresh the page.