Thx for your answers.
The compiler did raised an error, though I tried that after posting here : )

I did thought of modifying the xerces source code, but I don't want to
mess-up everything. And besides, if a new version is released, I would have
to implement this code again, and it could fail.

Which leaves me with the last option : "Create your own implementation
registry and use it instead"
How can I do that? I mean, if a class inherits from DOMDocument, how can I
use a Factory in my class's constructor?

Don't you think that the solution would be to call the DOMDocument
constructor (protected, but I can use it since I inherit from DOMDocument)
in my class's constructor?

Thanks again.


David Bertoni wrote:
> 
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Oh...-Tricky-one-%3A-%29-tp23279310p23291386.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


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

Reply via email to