Getting Data to the Client

Data is passed to the Commerce Server Business Desk HTML Components (HTCs) in the form of XML data-islands, frequently within the Web page itself. When the HTCs are executed by Internet Explorer 5 on the client, they can access and display this data for the Business Desk user.

For more information about the ways in which XML data-islands can be created on a page, see XML Data-Islands.

The DBUtil.asp include file defines several routines for producing XML data-islands in the correct format. These routines write all the resultant XML onto the page with the exception of the surrounding xml or script element, and its attributes. Note that the id attribute of both the xml and the script elements is required to identify the data-island to the HTC that is going to use it.

The DBUtil.asp include file contains two routines for converting ADO Recordset objects into the corresponding XML data-islands understood by the HTCs: xmlGetXMLFromRS and xmlGetXMLFromRSEx. It also includes two routines that result in the same XML data-islands, but that also include the database connection and query steps: xmlGetXMLFromQuery and xmlGetXMLFromQueryEx. For more information about these functions, see one of the following:

Many of the Microsoft Commerce Server 2000 COM objects are designed to return ADO Recordset objects specifically so that one of these routines can be called to convert them to XML data-islands on an ASP page.

The following code example shows how the invocation of the xmlGetXMLFromRS routine can appear within an xml element on an ASP page. Invocation of this routine and each of the other three routines can appear within an xml element, or within a script element containing the proper attributes to identify it as containing an XML data-island. The id attribute of the xml or script element, DataIslandID, is then assigned to the DataXML container attribute of the DIV element containing the corresponding HTC.

<xml id='DataIslandID'>
<%
    xmlGetXMLFromRS rsRecordset
%>
</xml>

From the perspective of the HTC, it is not important that the XML data-island be produced using one of the provided routines, or even that it be produced from an ADO Recordset object. All that matters from the perspective of the HTC is that the XML data-island be in the expected format. This design allows for greater flexibility with respect to where the data originates, and how it is processed prior to being converted to the proper XML format. The original data may be hard-coded on the page or even the result of an XSL transform.


All rights reserved.