Re: [XML-SIG] RE: Equality tests on DOM nodes

On Fri, 11 Dec 1998, Fred L. Drake wrote:

> 
> Gabe Wachob writes:
>  > Before you define equality generally for nodes, don't you have to define
>  > equality for each element and even each attribute? This may be a trivial
> ..
>  > Another issue would be order of children. Without a DTD, how do you tell
>  > when order of child elements is significant? Perhaps this has to be an
> 
>   Very good points.  This makes it incredibly expensive to "do it
> right" with any level of abstraction.
>   I guess it's not that hard to just write a routine that "does the
> right thing" for exactly what is needed in each case.  And it's
> looking increasingly appropriate.

Someone mentioned in this list or another that a set of objects
corresponding to a Visitor pattern is something that should be added to
DOM. There could be a default "equalityVisitor" that would have certain
default equality rules built in (lets say, a separate equality test method
for each DOM class). You could simply subclass the equalityVisitor to
modify the semantics of the equality test for whatever particular elements
you needed. Perhaps the equality visitor could simply have enough
configurable parameters to make it do what you want without having to
subclass.

The original context of the Visitor suggestion was for rendering XML into
HTML (I believe).

For info on Visitor Pattern see the Gang of Four book "Design Patterns"
http://iamwww.unibe.ch/CHOOSE/Articles/95-1/DP-book-review.html
 
	-Gabe


-------------------------------------------------------------------
http://www.aimnet.com/~gwachob               http://www.findlaw.com
"A popular Government, without popular information, or the means of 
acquiring it, is but a Prologue to a Farce or a Tragedy; or perhaps 
both." -- James Madison 
                       import std.disclaimer

Received on Monday, 14 December 1998 08:39:24 UTC