Hmmm... How does the C library itself handle comparison?
Well, in C the == is identity (comparing pointer addresses). libxml
does not provide an equality method that I see.
So there is no way to compare on content, only identity.
Well, its easy enough:
if node1.to_s == node2.to_s
Or
if node1.content == node2.content
to_s is like outerHTML and content is innerHTML (sort of).
Actually, how about this (pseudo):
def ==(arg)
if arg.kind_of? XML::Node
return true if self.id == arg.id
else
return true if self.to_s == arg
end
end
That way you don't have to create and throw away an object needlessly
in most comparison cases. -sc
--
Sean Chittenden
[EMAIL PROTECTED]
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel