Closed profburke closed 10 years ago
Hmm, that's curious. Does this work?
[xmldoc valuForKeyPath:@"link.attributes.rel"]
In the sense of not throwing an exception, yes :) But, it doesn't retrieve the attribute values.
Huh. OK, I'll look into it.
the @ symbol is treated specially in value for key path, as it denotes a collection operator https://developer.apple.com/library/mac/documentation/cocoa/conceptual/KeyValueCoding/Articles/CollectionOperators.html
It might need to be escaped somehow if its supposed to be part of a key name.
I'm afraid this was a misconception on my part. I've updated the documentation accordingly.
I haven't had a chance to dig into this yet, but when I try something like
[xmldoc valuForKeyPath:@"link.@attributes.rel"]
I get the following exception
*\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<__NSDictionaryM 0x8979d40> valueForKeyPath:]: this class does not implement the attributes operation.'
I've tried a few variations with no luck. Although
[xmldoc valueForKeyPath:@"link._rel"]
works, so this is not a show-stopper.