Microsoft KB Archive/271778

= SAMPLE: How to Retrieve Hierarchical Recordsets from XML Data Using MSDAOSP with ADO in Visual C++ =

Article ID: 271778

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft Data Access Components 2.6
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q271778



SUMMARY
The Ospxml.exe sample demonstrates how to retrieve hierarchical ActiveX Data Objects (ADO) recordsets from an arbitrary XML document using the Microsoft OLE DB Simple Provider (MSDAOSP) that ships with Microsoft Data Access Components (MDAC) version 2.6.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

Ospxml.exe

Release Date: Oct-17-2000

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. The Ospxml.exe file contains the following files:

The OSP Provider that ships with MDAC 2.6 has been enhanced to support opening hierarchical ADO recordsets over arbitrary XML files. The OSP Provider supports the following four different naming conventions for specifying the path to the file:
 * http://
 * file://
 * UNC path
 * Full DOS path

Limitations

 * Client cursors (adUseClient) are not supported.


 * Hierarchical recordsets cannot be persisted using the Save method of the Recordset object.


 * Recordsets created with the MSDAOSP are read-only.


 * The XMLDSO (MSXML2.DSOControl.2.6) adds an additional column of Data ($Text) to each recordset in the hierarchy.

The Ospxml.exe sample loads an arbitrary XML document named Portfolio.xml into the OSP Provider and outputs the hierarchical recordset retrieved from it. Additionally, the sample illustrates how to traverse the parent-child hierarchy recursively and ignore the $Text field while outputting the data.

Steps to Run the Sample

 * 1) Create an empty Win32 console application.
 * 2) Insert Ospxml.cpp into the project.
 * 3) Copy Portfolio.xml into the project folder.
 * 4) Compile and then run the application.

