xml4c extending classes

M

marfi95

I'm looking into adding a couple new things we need for Element nodes.
I was thinking of creating my own ElementNode class and inheriting from
DOM_Element, but I read somewhere that the XML4C dom classes were not
designed to be subclassed and thats why the Userdata field was added.
However, thats really not what I'm wanting to do.

Has anybody actually tried to extend the DOM api in XML4C ? Does
anybody have any samples they be willing to share ?

Thanks.
 
J

Joe Kesselman

DOM_Element, but I read somewhere that the XML4C dom classes were not
designed to be subclassed and thats why the Userdata field was added.

That's pretty generally true of DOM implementations. You would have to
subclass not just the individual nodes, but Document as well (to catch
all the node factories), plus dealing with any internal behaviors that
may construct nodes. Basically, you can't wrap additional behaviors
_around_ a DOM; you really need to build new behavior _into_ a DOM. Take
a look at the HTML DOM as an example -- that extends the XML DOM, but
needs fairly deep awareness of implementation details.

What are you actually trying to accomplish by subclassing? Sometimes the
right answer is to use the DOM event system in addition to the userdata
hook.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,006
Messages
2,570,265
Members
46,860
Latest member
JeremiahCo

Latest Threads

Top