On Sun, Jul 27, 2008 at 5:51 AM, Carter R. Harrison
<[EMAIL PROTECTED]> wrote:
> I'm having an interesting problem today.  I'm working with the event-driven
> XML parser in Core Foundation.  For those of you who aren't familiar with
> that parser, you have to implement at least 3 callback methods:

Those aren't methods, they're functions.

>
> void *createStructure(CFXMLParserRef parser, CFXMLNodeRef node, void *info)
> void addChild(CFXMLParserRef parser, void *parent, void *child, void *info)
> void endStructure(CFXMLParserRef parser, void *xmlType, void *info)
>
> Inside the addChild method, I attempt to access an instance variable that is
> defined within the header file for the source file in which the callback
> methods are defined.  For some reason the compiler is unable to see my
> instance variables when referenced from these methods.  The compiler gives
> me a "error: 'parseArray' undeclared (first use in this function)".
>
> Any ideas as to what I'm doing wrong?  Thanks in advance.

Functions don't have access to any instance methods (how could they,
they don't have an instance). Typically, what one would do is pass
'self' as the info parameter, and then either access instance
variables through info (by casting it to a pointer to your class
type), or simply call a method on that same instance, and do your work
there.

-- 
Clark S. Cox III
[EMAIL PROTECTED]
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to