Article ID: 272182 - Last Review: August 5, 2004 - Revision: 4.3

SAMPLE: How to Retrieve Hierarchical Rowsets from XML Data Using MSDAOSP in ATL OLE DB

This article was previously published under Q272182

On This Page

Expand all | Collapse all

SUMMARY

The Oledbospxml.exe sample demonstrates how to retrieve hierarchical OLE DB rowsets from an arbitrary XML document using the 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:
Oledbospxml.exe (http://download.microsoft.com/download/mdac26/7u8y/2.6/w9x2k/en-us/oledbospxml.exe)
Release Date: Oct. 12, 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  (http://support.microsoft.com/kb/119591/EN-US/ ) 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 Oledbospxml.exe file contains the following files:

Collapse this tableExpand this table
File nameSize
EULA.txt2 KB
Oledbospxml.cpp10 KB
Portfolio.xml1 KB

The OSP Provider that ships with MDAC 2.6 has been enhanced to support opening hierarchical OLE DB rowsets over arbitrary XML files. It supports four different naming conventions to specify the path to the file:
  • http://
  • file://
  • UNC path
  • Full DOS path

Limitations

  • Client-side cursors are not supported.
  • Rowsets that are created with the OSP are read-only.
  • The XMLDSO (MSXML2.DSOControl.2.6) adds an additional column of Data ($Text) to each rowset in the hierarchy.
This sample loads an arbitrary XML document, Portfolio.xml, into the OSP Provider and outputs data in the form of hierarchical OLE DB rowsets. In addition, the sample provides a CMyRowset class that supports chapters. Using this class, it illustrates how to traverse the Parent-Child hierarchy recursively and simultaneously output data, ignoring the $Text field.

Steps to Run the Sample

  1. Create an empty Win32 console application.
  2. Insert the Oledbospxml.cpp file into the project.
  3. Copy Portfolio.xml into the project folder.
  4. Make sure that the project is compiled using the Msdaosp.h file that ships with the MDAC 2.6 Software Development Kit (SDK).
  5. Compile and then run the application.

REFERENCES

OLE DB 2.6 Documentation
271778  (http://support.microsoft.com/kb/271778/EN-US/ ) SAMPLE: How to Retrieve Hierarchical Recordsets from XML Data Using MSDAOSP with ADO in Visual C++

APPLIES TO
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kbdownload kbdtl kbfile kbhowto KB272182
 

Article Translations