Dirk Brenckmann wrote: > >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...
The easiest approach is to register a DOMBuilderFilter [1] and in *acceptNode* attach the user data. Note that filter is called only for non-deferred node creation. > >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. As Joe mentions, you can also subclass Xerces DOM implementation and register it with the DOMParser [2]. Subclassing should not be hard, unless you want to change behavior of the DOM implementation. To get some ideas look at Xerces org.apache.xerces.dom.PSVIDocumentImpl. [1] http://www.w3.org/TR/2003/WD-DOM-Level-3-LS-20030226/load-save.html#LS-DOMBuilderFilter [2] http://xml.apache.org/xerces2-j/faq-dom.html#faq-2 -- Elena Litani / IBM Toronto --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
