Now to answer the question at hand.
It's hard to say if the ISA pointer is technically private. It is a part of the Objective-C runtime, and is therefore heavily documented. Many references to it can be found in the "Objective-C Runtime Reference":
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
The technique of changing the ISA pointer is called "isa-swizzling". In fact, I wrote a blog post about it here:
http://deusty.blogspot.com/2008/05/casting-subclassing-and-isa-field.html
As far as documentation from Apple is concerned, they make references to the ISA pointer in documentation on Key-Value Observing:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/KVOImplementation.html
They point out that they use isa-swizzling themselves:
"When an observer is registered for an attribute of an object the isa pointer of the observed object is modified, pointing to an intermediate class rather than at the true class."
And the guidance they offer on the topic is simply not to use the ISA value for obtaining the class of an object:
"Instead of relying on the isa pointer your application should use the class method to determine the class of an object instance."
However, much of this is a mute point, because with Objective-C 2.0 Apple added a method to change the class of an object:
object_setClass(id object, Class cls)
It is documented here:
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html#jumpTo_77
This method does the isa-swizzling for us, without us having to directly access the pointer.
So how did I fix the problem? Did I switch to the "object_setClass" method?
Actually, No.
I decided I could make the library a bit faster if I was more explicit about what types of objects I was creating, instead of depending on isa-swizzling. So I went through each place in the code that creates a new object, and verified it was creating the right type (DDXMLDocument vs DDXMLElement vs DDXMLNode). If I couldn't be absolutely sure what type, I used a new method that performs the proper checks prior to object allocation. In addition, I removed a bunch of duplicate checks for NULL.
I believe the end result should be a faster xml library.
Please report any issues you have with the library to the mailing list or to the Google Code Issue Tracker.
-Robbie Hanson
-Deusty Designs
I think it shouldn't remain unsaid that there's a lot of people who appreciate this code, including me and that there's a KissXML donation button on this page: http://code.google.com/p/kissxml/.
I agree that this is a gray area, if that. I just wish we could understand what Apple was/is thinking on this one and if they truly relaxed the checker when Aleksei submitted, or if there are inconsistent errors or... The only thing I can say with any certainty is what happened, what I changed, and the conclusion I drew from it.
Thanks for addressing this.
Matt
Well said. A little more communication from them would go a long way.
> Thanks for addressing this.
As a rule of thumb, when we hear users/developers having issues with our software/code, we assume that they're not the only ones. It's often the case that if several people are experiencing problems, only one of them will speak up. So thank you very much for reporting this issue to us.
-Robbie Hanson
-Deusty Designs
If you're using KissXML as part of HTTPRiot, I'll have a new version
up this weekend.
-Justin