At 11.49 05/02/2007 +0100, [EMAIL PROTECTED] wrote:
Hi Alberto,

Thanks a lot for the reply!

I've resolved the debugging issue now; apparently the DLL was older than the PDB, which doesn't help...

So now I can debug into Xerces, and I traced the importNode() call to DOMDocumentImpl::callUserDataHandlers(), where it enumerates over the user data table. However, userDataEnum.hasMoreElements() returns false on the first iteration, which apparently means that there are no handlers, am I correct? But as I said, my handler does get called when I delete nodes...

Do you have any more clues?

If I read the code right, the handler for importing nodes must be registered on the DOMDocument itself, so you can workaround the problem by registering the handler there; but by reading the specs this is wrong, as "the application can provide a handler that gets called when the node the object is associated to is being cloned, imported, or renamed". Unless someone else has problems with this, I'm going to fix this for 3.0.

Alberto


Cheers,

Uwe


Alberto Massari amassari-at-datadirect.com |xerces-c-users mailing list| schrieb:
At 01.09 03/02/2007 +0100, you wrote:
Hello,

I overrid XercesDOMParser's startElement() method to attach user data to each newly created DOMNode. This works fine, and I can retreive the data later with getUserData().

However, I now merge two documents into one DOM, and I use importNode() for copying the nodes into the main document, collecting the nodes in a DocumentFragment first, and then adding them to the main document with replaceChild().

a) The new nodes in the main document don't have the user data any more;
b) The data handler is not called while executing importNode(). However, it _is_ called when I delete the parser, when all nodes it owns are deleted, which means that it should be properly registered.

Any clues what I could have done wrong here? I Use Xerces 2.7.0.

Uwe,
the code for importNode calls the NODE_IMPORTED handler (unless you are cloning the entire document); can you verify if it invoked?

Cheers,

Uwe

P.S.: For some odd reason I never manage to debug into Xerces from my application on my Windows XP/VS7.1 installation, although the PDB and sources should be accessible; I compiled Xerces myself. Does anyone have experience with this?

Is the PDB in the same folder of the Xerces DLL being loaded?

Alberto

Reply via email to