Subclassing NSCoder
Subclassing NSCoder
- Subject: Subclassing NSCoder
- From: Meik Schuetz <email@hidden>
- Date: Sun, 31 Aug 2008 16:45:35 +0100
Dear everyone,
I am trying to create my own NSCoder implementation to serialize
objects to a XML format which would like to use to communicate with
WCF service. The serialization is already done and I had no problems
do it, however I've got some conceptional questions about the de-
serialization:
Given the serialized XML:
<EntityKey>
<stringValue>HELLO WORLD</stringValue>
<boolValue>True</boolValue>
<intValue>12</intValue>
<compositeValue>
<stringValue>THIS IS THE SECOND INSTANCE</stringValue>
<boolValue>False</boolValue>
<intValue>4711</intValue>
<compositeValue></compositeValue>
<arrayOfString><Value>1</Value>
<Value>2</Value>
<Value>3</Value>
</arrayOfString>
</compositeValue>
<arrayOfString><Value>1</Value>
<Value>2</Value>
<Value>3</Value>
</arrayOfString>
</EntityKey>
How would you de-serialize the node <CompositeValue> (which is a
composite value of type CompositeType, having the attributes
stringValue, boolValue, intValue, compositeValue and arrayOfString)?
1) Would you store information about the type in the XML and let the
NSCoding subclass have the intelligence to create and initialize the
object (ex. via NSClassFromString)?
2) Or would you place this intelligence in the entity
object's :initWithCoder? If so, how would you create and initialize
the composite object passing the Coder reference?
Hope I made my problem more or less understandable
Best regards
Meik
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden