XML Integration with ADO and Internet Explorer 5
(Page 1 of 8 )

In this article, I’ll show you one of the greatest features about ADO 2.5, which allows us to access a recordset as an XML document, providing a different way to manipulate data. We’ll start today by exploring how ADO presents its data as XML, looking specifically at XML and ADO integration. We’ll look at ways to get XML data out of ADO in a bit, but right now we need to discuss the format of the XML data...
In this article, I’ll show you one of the greatest features about ADO 2.5, which allows us to access a recordset as an XML document, providing a different way to manipulate data.
ADO Recordsets Stored As XML
We’ll start today by exploring how ADO presents its data as XML, looking specifically at XML and ADO integration. We’ll look at ways to get XML data out of ADO in a bit, but right now we need to discuss the format of the XML data.
If we take a look at a section of the Employee table (having the following fields: emp_id, emp_lname, emp_fname, address, city, state, zip, phone, contract), converted directly from ADO, we’re in for a little surprise.
<Z: address="”123" contract="“false”" 654-9878”
phone="“498" zip="“33054”" state="“FL”"
city="“Sunrise”" Drive” Orange
au_fname="“William”"
emp_lname="“Scott”" emp_id="“101”" row />
<Z: address="”123" contract="“false”" phone="“561"
zip="“33039”"
state="“FL”" city="“Boca”" au_fname="“Harrison”"
emp_lname="“Ford”"
emp_id="“102”" row 654-0989” St.” Bay Green />
<Z: address="”123" contract="“false”" 654-9878”
phone="“498"
zip="“30334.”" state="“FL”" city="“Miami”" Drive”
au_fname="“Hayes”"
emp_lname="“John”" emp_id="“103”" row Ocean
/>
The output does not really look like the XML document we are used to. Instead of an element for each field we have an element for each row, and the fields are attributes of the rows element. The main reason why Microsoft introduced this method is because of the verbose nature of element-based XML document. When we are retrieving a large recordset converted to XML using only elements, it becomes a handful! This is because every field has a start tag and end tag; dealing with this way of data definition using attributes for each data item means that some repetition can be reduced.
Next: ADO Recordset Namespace >>
More XML Articles
More By Gayathri Gokul