Re: [libxml-devel] Changing node equality

2008-07-09 Thread Sean Chittenden
Not the same thing. Comparing raw XML string is overly strict. For example I would expect the following two snips to be "equal": Hi Hi These would not be equal by string comparison b/c the attribute bar and baz are not in the same order (to say nothing of white space). Actuall

Re: [libxml-devel] Changing node equality

2008-07-09 Thread Trans
On Jul 8, 2:37 pm, Charlie Savage <[EMAIL PROTECTED]> wrote: > Trans wrote: > > > On Jul 8, 12:04 pm, Charlie Savage <[EMAIL PROTECTED]> wrote: > >>> Hmmm... How does the C library itself handle comparison? > >> Well, in C the == is identity (comparing pointer addresses).  libxml > >> does not pr

Re: [libxml-devel] Changing node equality

2008-07-09 Thread Charlie Savage
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 Deal - I'll do that. Charlie smime.p7s Description: S/MIME Cryptographic Signature

Re: [libxml-devel] Changing node equality

2008-07-08 Thread Sean Chittenden
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 nod

Re: [libxml-devel] Changing node equality

2008-07-08 Thread Charlie Savage
Trans wrote: On Jul 8, 12:04 pm, Charlie Savage <[EMAIL PROTECTED]> wrote: 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,

Re: [libxml-devel] Changing node equality

2008-07-08 Thread Trans
On Jul 8, 12:04 pm, Charlie Savage <[EMAIL PROTECTED]> wrote: > > 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 ide

Re: [libxml-devel] Changing node equality

2008-07-08 Thread Charlie Savage
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. Charlie smime.p7s Description: S/MIME Cryptographic Signature ___ libxm

Re: [libxml-devel] Changing node equality

2008-07-08 Thread Trans
On Jul 7, 11:20 pm, Charlie Savage <[EMAIL PROTECTED]> wrote: > Dan Janowski wrote: > > I think this is a vestige of the old fact that there could be two ruby > > objects that referred to the same XML node. Since I removed that and now > > there is only a one-to-one relationship between the ruby

Re: [libxml-devel] Changing node equality

2008-07-07 Thread Charlie Savage
Dan Janowski wrote: I think this is a vestige of the old fact that there could be two ruby objects that referred to the same XML node. Since I removed that and now there is only a one-to-one relationship between the ruby peer and the XML node, if == is equivalent to equal? and equal? is objec

Re: [libxml-devel] Changing node equality

2008-07-07 Thread Dan Janowski
I think this is a vestige of the old fact that there could be two ruby objects that referred to the same XML node. Since I removed that and now there is only a one-to-one relationship between the ruby peer and the XML node, if == is equivalent to equal? and equal? is object identity, then i