views:

37

answers:

1

I'm upgrading a project to use the 10.5 SDK. I'm getting warnings of this form:

warning: 'getAttributeNS::' is deprecated (declared at /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/WebKit.framework/Headers/DOMElement.h:74)

...for getAttributeNS, hasAttributeNS, removeAttributeNS, replaceChild, and getElementsByTagNameNS.

I've looked at the header referenced, and I see that they are indeed marked deprecated via some Macro Magic. I also found some "documentation" on Apple's developer site, but it just lists the interfaces. It doesn't give any guidance on how to use them or what to use instead.

So, any advice on (a) how to figure out what to use instead, and (b) what I should actually use instead, would be very much appreciated.

+1  A: 

According to the 10.5 WebKit changes, there are now methods called getAttributeNS:localName: and so on, and a replaceChild:oldChild: method of DOMNode.

Chuck
It is not clear to me how that is useful. That document is just listing the methods I already know about that are marked deprecated in the header.
jeffamaphone
`getAttributeNS:localName:` is not the same as `getAttributeNS::`.
Nate
Okay. Please forgive my total n00bness here; can you give example usage of the old vs. the new?
jeffamaphone
Nevermind, I figured out the Objective C madness here. Not sure what the technical explanation is, but I just had to put "localName" in front of the second argument thing.
jeffamaphone
Sorry, just got back to this. Yeah, that's how arguments work in Objective-C — each colon corresponds to one argument. It's sort of a poor man's version of keyword arguments.
Chuck
So, the deprecated versions were "anonymous" or something?
jeffamaphone
I guess you could say that. My guess is that they were autogenerated from the corresponding C functions, and the generator didn't know what to label the arguments.
Chuck
Heh, wow. Seems like that should have caused a warning or something.
jeffamaphone
It's perfectly valid, just not very descriptive. The language requires that there be one colon in the method name for every argument. The name `getAttributeNS::` fulfills that criterion for a two-argument method. That's why there's no warning.
Chuck