Use the C++ XML Data Source Object

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XML Developer's Guide

Use the C++ XML Data Source Object

What is the C++ XML Data Source Object?

Microsoft® Internet Explorer 5.0 and later is released with a C++ Data Source Object (DSO) that can be used to bind XML to HTML. Microsoft Internet Explorer 4.0 was released with a Java XML DSO that is still supported in Internet Explorer 5.0 and later; however, the new C++ DSO gives you better performance and the ability to bind directly to an XML data island.

The C++ DSO allows you to create XML-driven Web applications in a completely declarative fashion, although it is still possible to write scripts against the XML document object. With the C++ DSO, both the Microsoft ActiveX® Data Objects (ADO) and XML object models are available to you.

How do I bind XML to HTML?

Consider the following XML file.

<universities>
  <university>
    <name>UCSB</name>
    <location>Santa Barbara, CA</location>
  </university>
  <university>
    <name>University of Texas at Arlington</name>
    <location>Arlington, TX</location>
  </university>
  <university>
    <name>USM</name>
    <location>Hattiesburg, MS</location>
  </university>
  <university>
    <name>Baylor</name>
    <location>Waco, TX</location>
  </university>
</universities>

You can bind this XML to a repeating table with the following HTML.

<XML ID=xmlDoc src="universities.xml"></XML>
<TABLE DATASRC="#xmlDoc" BORDER=1> 
  <THEAD><TH>NAME</TH><TH>LOCATION</TH></THEAD>
  <TR>
    <TD><SPAN DATAFLD="name"></SPAN></TD>
    <TD><SPAN DATAFLD="location"></SPAN></TD> 
  </TR>
</TABLE>

Click the button below to view the table created.

UCSB Santa Barbara, CA University of Texas at Arlington Arlington, TX USM Hattiesburg, MS Baylor Waco, TX
NAME LOCATION

There is no need for an <APPLET> or <OBJECT> tag; the XML DSO does all the work for you.

Try it!

For more information, see the XML Data Source Object demo in MSDN® Online Downloads. Download the sources for that demo and see if you can change the display format from a form to a repeated table.

Other Resources Other Resources

XML Data Source Object Demo