Smart Pointer Classes and DOM Methods with an [out, retval] Parameter

MSXML 5.0 SDK

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

Smart Pointer Classes and DOM Methods with an [out, retval] Parameter

When a method has an [out, retval] parameter, the syntax is different depending on whether you use smart pointer class wrappers or the raw interface method. We use the load method as an example.

Raw Interface Syntax

HRESULT load(
   [in] VARIANT xmlSource,
   [out, retval] VARIANT_BOOL *isSuccessful
);

For example,

hr = pXMLDom->load("myData.xml", &vbStatus);

where hr, pXMLDom, and vbStatus are of the HRESULT, IXMLDOMDocument*, and VARIANT_BOOL types, respectively.

Smart Pointer Class Wrapper Syntax

VARIANT_BOOL load(
   [in] VARIANT xmlSource
);

For example,

vbStatus = pXMLDom->load("myData.xml");

Notice that the DOM method call using smart pointer classes is similar to that in script or Visual Basic.