perfectxml.com
 Basic Search  Advanced Search   
Topics Resources Free Library Software XML News About Us
home » focus » msxml » ask a question » past questions & answers Friday, 12 October 2007
 
NEWS
MSXML 4.0 SP2 now available!

 
MSXML
Basics
DOM
SAX
XPath
XSLT
Schemas
SOM
HTTP Access
.NET
Data Islands
Ask a Question
   Past Q&As
C++ Samples
DLL/Version Info
Reference Guide
Books
KB Articles
   HOW TO
   SAMPLE
   INFO
   BUG/PRB
   FIX
   Misc.
MSXML Tips
   August 2002
   September 2002
MSXML Tools

Microsoft XML Core Services


Go back to list of previously asked questions and answers

Question: In many C++ examples, I have seen IXMLDOMDocument2Ptr being used, however I am not able to find it in the MSXML DLL that I have, and what's the benefit of using IXMLDOMDocument2Ptr instead of IXMLDOMDocument.
Asked By: Kalyan
Viewed: 4580
Answer: IXMLDOMDocument2Ptr is the smart pointer for IXMLDOMDocument2 interface, which you can use after #importing MSXML DLL.

IXMLDOMDocument2 is the new interface derived from IXMLDOMDocument. Depending on which version of MSXML typelib/DLL you are using, you may or may not see this. For instance, if you look at MSXML.DLL version 8.0.6730.0, you'll not find IXMLDOMDocument2 interface and hence when you #import this DLL, you'll not be able to see and use IXMLDOMDocument2Ptr smart pointer. However if you look at MSXML2.dll version 8.2.8307.0 or MSXML3.dll or MSXML4.dll (using OLE View), you'll see IXMLDOMDocument2 defined as below:

    [
      odl,
      uuid(2933BF95-7B36-11D2-B20E-00C04F983E60),
      dual,
      nonextensible,
      oleautomation
    ]
    interface IXMLDOMDocument2 : IXMLDOMDocument {
        [id(0x000000c9), propget, helpstring("A collection of all namespaces for this document")]
        HRESULT namespaces([out, retval] IXMLDOMSchemaCollection** namespaceCollection);

        [id(0x000000ca), propget, helpstring("The associated schema cache")]
        HRESULT schemas([out, retval] VARIANT* otherCollection);

        [id(0x000000ca), propputref, helpstring("The associated schema cache")]
        HRESULT schemas([in] VARIANT otherCollection);

        [id(0x000000cb), helpstring("perform runtime validation on the currently loaded XML document")]
        HRESULT validate([out, retval] IXMLDOMParseError** errorObj);

        [id(0x000000cc), helpstring("set the value of the named property")]
        HRESULT setProperty(
                        [in] BSTR name, 
                        [in] VARIANT value);

        [id(0x000000cd), helpstring("get the value of the named property")]
        HRESULT getProperty(
                        [in] BSTR name, 
                        [out, retval] VARIANT* value);
    };
And when you import one of these DLL you'll be able to use IXMLDOMDocument2Ptr. IXMLDOMDocument2 adds 3 properties and 3 methods as indicated above. To use them, you must use IXMLDOMDocument2 interface.

More information:
MSXML C++ Samples
MSXML DLL/Version Info


Go back to list of previously asked questions and answers
  Contact Us |  | Site Guide | About PerfectXML | Advertise ©2004 perfectxml.com. All rights reserved. | Privacy