Am 19.03.2003 15:10:51, schrieb Joseph Kesselman <[EMAIL PROTECTED]>:
>>attach additional features to nodes and elements created by xerces.
>Possible approaches:
>1) See the DOM Level 3 "user data" feature; I believe Xerces has
>prototyped that functionality.
Yes, and it works.
Problem: During node creation, which usually is something like "configuration-"
or "initialization-"time of the application, you can only rely to be notified, if you
1. subclassed the parser
2. Overwrote the parsers createElement method
3. Set the feature of deferred node creation to false...
Of course you can take another aproach. Walk the DOM after having created it,
and attach the "userinfo" one by one...
I think this is quite complicated.
>2) Plug in a new DOM implementation. (Simplest: Use Xerces as a SAX
>parser, feed its output into a SAX-driven DOM builder of your choice.) It
>is possible, though not easy, to subclass the Xerces DOM; you may find it
>simpler to copy that code and modify it.
I did so and was asking myself: "Why should any application, which is in need of
some specific nodetypes do so, if xerces could provide another way, which opens
a third, more simple approach:"
1. Notification upon node creation
either:
2.1 Wrap the new Node into a Wrapper/Proxy
2.2 Return the Wrapper/Proxy to become a node/childnode in the DOM
2.3 Append the Wrapper/Proxy to your application, to become a configurable
part of it.
or:
2. Append user data
So you can rely on notifications, you don't need subclassing of DocumentImpl,
NodeImpl, FooImpl and have to do very little programming to implement a wrapper
or handler for the proxy.
Benefit: Proxies and Wrappers can show other Interfaces, even implement additional
Services which go far beyond the functionality of a simple node and they can directly
become part of an application (Not just as a config or data DOM-Node)
I just wanted to start a discussion on this idea and - when it turns out to be
successful,
I'd implement the code. If this is not the right group, sorry for my approach.
Dirk Brenckmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]