Hi everyone,
I'd appreciate some feedback on a particular approach I'm thinking of using. The scenario is below.
I have an object (lets call it MObject) that has a number of properties, say, x and y coordinates, height and width. The properties are named according to the KVC guidelines (MObject.x; MObject.height, etc). My next task, is to read in an XML file that describes this MObject. Unfortunately, the XML elements are named differently -- X and Y, Height and Width (note the capitalization).
Ideally, the XML elements would match up with MObject's properties. In this case, I could use KVC and avoid a whole whack of code:
for (xmlProperty in xmlElement)
{
[MObject setValue:xmlProperty.value forKey:xmlProperty.name].
}
One way of approaching this would be to make use of case-insensitive keys. Where would I start with that? Are there any other, better solutions?
Suggestions very much appreciated.