Board index » cppbuilder » comparing interface-pointers (MSXML)

comparing interface-pointers (MSXML)


2005-06-14 06:14:06 PM
cppbuilder49
Hello,
I'm working with MSXML. A node inside an XML-document is represented as a
Msxml2_tlb::IXMLDOMNodePtr (which is an interface-pointer). Now, I want to
compare two nodes (I'm saving a specific node-position inside my document
and while im browsing through it, I want to check if I reached the saved
position).
When go like this:
Msxml2_tlb::IXMLDOMNodePtr pXMLPtr1, pXMLPtr2;
...
while(pXMLPtr1 != pXMLPtr2) { ...}
I receive the following compiler-error:
[C++ Fehler] XML.cpp(1503): E2015 Mehrdeutigkeit zwischen
'IXMLDOMNodePtr::operator Msxml2_tlb::IXMLDOMNode *() const' und
'IXMLDOMNodePtr::operator bool() const'
Also casting the interfaces like:
while((Msxml2_tlb::IXMLDOMNodePtr)pXMLPtr1 !=
(Msxml2_tlb::IXMLDOMNodePtr)pXMLPtr2) { ...}
doesn't solve the problem.
So, is there any solution, perhaps a special COM-implementation?
Thanks,
Uli.
 
 

Re:comparing interface-pointers (MSXML)

"Uli" < XXXX@XXXXX.COM >wrote in message
Quote
I'm working with MSXML. A node inside an XML-document is
represented as a Msxml2_tlb::IXMLDOMNodePtr (which is an
interface-pointer). Now, I want to compare two nodes (I'm saving
a specific node-position inside my document and while im browsing
through it, I want to check if I reached the saved position).
You should not be comparing the pointers directly. Use something else.
Gambit
 

Re:comparing interface-pointers (MSXML)

Quote
Msxml2_tlb::IXMLDOMNodePtr pXMLPtr1, pXMLPtr2;
...
while(pXMLPtr1 != pXMLPtr2) { ...}

If MSXML is just giving you another instance on the same object, then query
both objects for the IUnknown internface and compare the returned pointers.
The COM spec specifies that 2 internfaces refer to the same object if their
IUnknown interfaces are equal.
Mark
 

{smallsort}