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



The information in this article applies to:

  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7
  • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0
  • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q272182

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:
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 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:

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 SAMPLE: How to Retrieve Hierarchical Recordsets from XML Data Using MSDAOSP with ADO in Visual C++


Modification Type:MinorLast Reviewed:8/5/2004
Keywords:kbdownload kbDTL kbfile kbhowto KB272182 kbAudDeveloper