Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DOMDocument2 and validate in MSXML

24 views
Skip to first unread message

Rainer A. Ludwig

unread,
Jul 20, 2001, 11:10:11 AM7/20/01
to
Hi,

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

0 new messages