Damn! I was to slow typing this. First thing I saw after I sent it was that
someone else had given the same answer.... and code to come with it!
Man I do LOVE this mailing list :)

/ Erik

-----Original Message-----
From: Erik Rydgren [mailto:[EMAIL PROTECTED]]
Sent: den 9 januari 2003 19:01
To: [EMAIL PROTECTED]
Subject: RE: Dom Bridge


That is a backward way of doing things but if you already is sitting in that
uncomfortable chair....

If I should have to do it then I would do it something like this.

Fake the whole damn tree!
Inherit and override the needed classes. (If you do not need text nodes then
ignore them)
Create nodes on the fly.

Example: The user calls the method getNextSibling on a DOMElement I have
provided.
 - The call goes into MY class FakeDOMElement::getNextSibling() because the
method is declared virtual.
 - My class then have a reference to a position in my internal structure. I
use that stored info to find the corresponding position that represent the
sibling node. Then I create a new FakeDOMElement object which references the
new info. Then returns the new object (The user will use the new object as a
DOMElement totally oblivious of the internal data structure)

The problem with this is that you will not know when the user is finished
with the node.
Easy way is to store the objects in a nice hashtable in the FakeDOMDocument
object and always consult it before creating new nodes to avoid duplicates.
Then delete all nodes when the user deletes the document.
Worst case scenario is that the user traverses the whole tree and hence you
will have to create and hold the whole tree in memory.

Regards

Erik Rydgren
Mandarinen systems AB
Sweden

-----Original Message-----
From: Alan LaViolette [mailto:[EMAIL PROTECTED]]
Sent: den 9 januari 2003 17:42
To: [EMAIL PROTECTED]
Subject: Dom Bridge


Hello,

I don't know it this is the correct group for this message but I could
not find a xerces-c-users list.

I am looking at using xerces and xalan in an existing application to add
XML functionality.   I have a method of mapping our internal structure
into a XML DOM.  But I do not want to create the full DOM structure for
the application because this would be very large.  So I was wondering if
I can in any way,  create the DOM structure on the fly as needed by
other applications.  To do this would I need to inherit from all the
DOMNode based classes to create the bridge, or could I just customize
DOMNode to provide the dynamic on the fly creation of the child nodes
and attributes.

Has anyone see an application like this to point me to for examples?

--
Alan LaViolette
mailto:[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to