has anyone tried to use the validate method (member of
IXMLDOMDocument2) of MSXML (3.0, say) in BCB 5? My code looks like
follows:
//--------------------------------------------
::IXMLDOMDocument2 * G_pDOM;
HRESULT hr;
G_pDOM = NULL;
hr = CoInitialize(NULL);
if (FAILED(hr))
ShowMessage("Fehler beim Initialisieren von COM!"); //never mind
;-)
hr = CoCreateInstance(::CLSID_DOMDocument, NULL,
CLSCTX_INPROC_SERVER,
::IID_IXMLDOMDocument2, (void **)&G_pDOM);
//---------------------------------------------
Now, if I call a member of DOMDocument, say
put_validateOnParse(VARIANT_TRUE), the compiler complains about
put_validateOnParse not being a member of DOMDocument2. Doesn't
DOMDocument2 inherit from DOMDocument (MS claim so)? Or is there no
such thing like inheritance in COM? If so, how do I reach the members
of a different interface? I've tried quite a few things, e. g.
QueryInterface:
//---------------------------------------------
::IXMLDOMDocument * G_pDOM2;
hr = G_pDOM->QueryInterface(::IID_IXMLDOMDocument, (void
**)&G_pDOM2);
//---------------------------------------------
I even took a chance on dynamic_cast...
The other way round of course, if I let G_pDOM be a ::IXMLDOMDocument
in the first place, I do get access to put_validateOnParse and the
like, but none to validate, which is the method I'd really like to
use. In this case however, if I QueryInterface for ::IXMLDOMDocument2,
no one complains and I then can call validate on the newly won
interface -- but this will always succeed, even if the document is
*not* valid *for sure*.
TIA for any help on this.
regards,
Rainer Ludwig