xml4c extending classes

Discussion in 'XML' started by marfi95@yahoo.com, Oct 19, 2006.

  1. Guest

    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.
     
    , Oct 19, 2006
    #1
    1. Advertising

  2. wrote:
    > 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.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Oct 19, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anthony Williams
    Replies:
    8
    Views:
    567
    Anthony Williams
    Feb 24, 2004
  2. H.L Bai
    Replies:
    1
    Views:
    418
    H.L Bai
    Jan 5, 2004
  3. =?Utf-8?B?RmF0IEVsdmlz?=

    Extending ASP.net pages using Partial Classes

    =?Utf-8?B?RmF0IEVsdmlz?=, Jun 15, 2006, in forum: ASP .Net
    Replies:
    9
    Views:
    512
    =?Utf-8?B?RmF0IEVsdmlz?=
    Jun 20, 2006
  4. Lars Moastuen
    Replies:
    3
    Views:
    522
    Lars Moastuen
    Nov 26, 2004
  5. xml4c child nodes

    , Oct 12, 2006, in forum: XML
    Replies:
    14
    Views:
    858
    Joseph Kesselman
    Oct 12, 2006
Loading...

Share This Page