XML Integration with ADO and Internet Explorer 5 - Binding Hierarchical Data
(Page 8 of 8 )
The examples we’ve looked at so far have been quite simple, but you’ll find a problem if you try to bind a set of XML data generated by ADO. The reason is that IE doesn’t recognize schemas as a definition of the data. IE looks at it as follows:
<XML>
<s:Schema data>
…..Your schema data goes here
</s:Schema data>
<rs:data>
<z:row……/>
<z:row……/>
</rs:data>
</XML>
So, IE sees two sets of data: the Schema and the actual data. We have an additional problem to handle because we saw that data we want is held within the row. In short our data is two levels deep, which means extra work on our part. The solution is to use two levels of binding. We will see the sample DataBinding.html for the present scenario.
<TABLE dataFld=“rs:data” id=“tblData” dataSrc=“#diData”>
<TBODY>
<TR>
<TD>
<TABLE dataFld=“z:row” id=“tblData” dataSrc=“#diData” border=“1” <TR>
<TBODY>
<TR>
<TD><SPAN dataFld=“emp_id”></SPAN></TD>
<TD><SPAN dataFld=“emp_fname”></SPAN></TD>
Here, we bind the outer table to the elements containing all of the data. In the second step, we have an inner table bound to the row of data. Finally the fields are bound, just as before.
In the next part of the tutorial we will take a plunge into multiple levels of hierarchy, such as from a data shaped recordset, then we will add more levels to the binding. I hope that today’s section left you confident about integrating XML data with ADO and IE. Remember, experimentation is your friend. If you feel you need more practice, write up some code of your own! I think you’ll begin to enjoy this once you begin to really understand it.