KissXML icon indicating copy to clipboard operation
KissXML copied to clipboard

isEqual: behaves differently to Apple NSXMLNode/Element

Open chadbag opened this issue 9 years ago • 1 comments

This should be noted in the documentation or code comments. KissXML "isEqual:" compares class and then object pointer only for the underlying libxml node.

Apple's "isEqual:" says:

"By default NSXMLNode implements the NSObject isEqual: method to perform a deep comparison: two NSXMLNode objects are not considered equal unless they have the same name, same child nodes, same attributes, and so on. The comparison looks at the node and its children, but does not include the node’s parent. If you want a different standard of comparison, override isEqual:."

Things that would be equal under Apple fail under KissXML. I am not asking for it to be changed, but just recommending that it be noted in the code comments are somewhere convenient so that users of KissXML can plan around the difference.

I noted this by creating an XMLString of a node and then creating another node using that XMLString and comparing them with "isEqual:". Creating new XMLString from both show that they are exactly the same.

chadbag avatar Aug 16 '16 18:08 chadbag

Send pull request and I'll merge thanks

On Tue, Aug 16, 2016 at 11:29 AM, chadbag [email protected] wrote:

This should be noted in the documentation or code comments. KissXML "isEqual:" compares class and then object pointer only for the underlying libxml node.

Apple's "isEqual:" says:

"By default NSXMLNode implements the NSObject isEqual: method to perform a deep comparison: two NSXMLNode objects are not considered equal unless they have the same name, same child nodes, same attributes, and so on. The comparison looks at the node and its children, but does not include the node’s parent. If you want a different standard of comparison, override isEqual:."

Things that would be equal under Apple fail under KissXML. I am not asking for it to be changed, but just recommending that it be noted in the code comments are somewhere convenient so that users of KissXML can plan around the difference.

I noted this by creating an XMLString of a node and then creating another node using that XMLString and comparing them with "isEqual:". Creating new XMLString from both show that they are exactly the same.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/robbiehanson/KissXML/issues/71, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfqH3ZK74w2m_L1ck2DKKuxnmbJlAyZks5qggF2gaJpZM4Jlth4 .

chrisballinger avatar Aug 16 '16 20:08 chrisballinger