Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 151385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:26:29+00:00 2026-05-11T09:26:29+00:00

Is there a way to do something similar to KVC but use the message

  • 0

Is there a way to do something similar to KVC but use the message name as the key itself? For example, rather than valueForKey:, is there a way for an object to respond to all messages?

For example, say you have an XML document:

<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE ...> <employees>   <employee>     <name>Bill</name>     <department>Accounting</department>   </employee>   <employee>     <name>John</name>     <department>Human Resources</department>   </employee> </employees> 

Besides using the already-available NSXMLDocument and co., would there be a way to implement some sort of abstraction so you could do:

MyXML *xmlDoc = [[MyXML alloc] initWithContentsOfFile:@'test.xml'];  NSLog (@'%@', [[[xmlDoc employees] first] department]);  [[[xmlDoc employees] first] setDepartment:@'Management']; 

I chose XML just as an example, but I want to know whether this is possible at all, and whether or not it involves getting too close to the Objective-C runtime or whether it is supported by the runtime itself, and how I would go about implementing something like this. This is purely for experimental purposes and I understand that there will likely be significant performance costs.

EDIT:
If possible, I’d like to avoid existing frameworks such as Cocoa and use the base Objective-C object Object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:26:29+00:00Added an answer on May 11, 2026 at 9:26 am

    You need to implement forwardInvocation: and methodSignatureForSelector: to handle unrecognized messages. It is described in the NSObject reference.

    EDIT: Wikipedia has an example of how forwarding can be accomplished for Object, basically by implementing forward: and performv:.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there some way to use something similar to x-sendfile for uploading files, e.g.
Is there a way to do something similar to a SourceSafe label in svn?
Is there any way to implement something similar to Chatroulette without using Flash or
Is there a way through the .Net aframework (or has someone written something similar)
Is there a way to shorten type names in java. Something similar to typedef
Is there a simple way to see assigned shortcuts with given prefix? Something similar
Is there a way to obtain something like a dictionary of all key-value pairs
Is there any way to create something similar to this: class F[A] {def apply(a:
Is there a way to achieve something similar to scripting in svg file, so
Is there a way to apply CI Filters to MKMapViews ? Or something similar?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.