[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] Achieving object model independence
At 07:51 PM 11/18/2001 +0100, Bruno Dumon wrote:
>Jim Wissner wrote:
>>2. Create my own set of basic interfaces that mirror common object model
>>components (Document, Element, Attribute), subclass the implementation
>>classes of the corresponding dom4j/JDOM/DOM classes, set the appropriate
>>factory methods to create instances of the subclasses that implement my
>>common interfaces, and return those common interfaces to the rest of my
>>I currently use this method with Xerces in order to implement undo/redo
>>of DOM mutations, and it is quite effective. Nevertheless this approach
>>makes me uneasy because it is dependent on utilizing "nonpublic"
>>components (that is, having to subclass the default implementation
>>classes which, though often public in the sense of Java scoping, are
>>sometimes left out of documentation and presumably more subject to change
>>than the rest of the APIs. Is this true, or am I being overly worrisome?)
>Not related to the original subject, but:
>To implement undo when using Xerces, you could as well use the DOM
>mutation events, which Xerces supports. Just register event listeners on
>the document node for all mutation events. Then it is easy to record all
>changes so that they can be undone later.
Yes, thanks.. It's probably a better way to go as far as Xerces is
concerned. I believe this is new in DOM Level 2. I don't remember it
existing when I originally wrote the undo/redo mechanisms long, long ago.
I'm reluctant to change to this event system, since of course not all
object models implement DOM level 2. I'd really like to find a way to make
these features available to my apps in a cross-object-model way.
Care to comment on this original topic? Please? :) I'm still waiting for
some great advice.
Open Source Software
Java - XML - Speech Recognition