radada wrote:
Hi there again

For some reasons, which would be too long to describe, I want to subclass
the DOMDocument class into a XMLDocument class.
In other words, XMLDocument inherits from DOMDocument.
DOMDocument is an abstract base class, so you will need to implement every pure virtual function in your derived class. Perhaps it would be better to derive your class from DOMDocumentImpl, but that could be tricky, because DOMDocumentImpl was probably not designed to be a base class.

Here's the tricky question : since the DMODocument uses a factory to be
create (createDocument method from DOMImplementationRegistry), how can I
build an XMLDocument.

Do you know if this works :
XMLDocument:: XMLDocument()
{
   DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("LS")); this = (XMLDocument*) impl->createDocument();
}
It is illegal to assign to the "this" pointer, and the compiler will emit an error if your code does this. I'm surprised your compiler didn't.

Even if you were allowed to assign to the this pointer, the cast is illegal. Casting a pointer doesn't change the type of the object being pointed to.


If not, what solutions can I have other than creating a class that does not
inherits from DOMDocument and simply have a DOMDocument variable?
I can think of several ways to do this:

  1. Create your own implementation registry and use it instead.
2. Modify the Xerces-C source code to create an instance of your type instead of DOMDocumentImpl.

I would caution you to be very careful when doing this, because you need to ensure your implementation is 100% compliant with the existing implementation.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to