MBEntity Class Reference
Inherits from | NSObject |
Conforms to | NSCoding |
Declared in | MBEntity.h MBEntity.m |
Overview
Base class for all elements in the XML Webservice Schema
MBEntity does all the heavy lifting. MBEntity takes the data from the webservice response and will create the corresponding objects, set the corresponding properties, and if the xml response represents an unknown yet still valid attribute or element, the extra information will be stored in ExtraAttributes and ExtraElements, respectively.
Tasks
Other Methods
-
ExtraAttributes
Extra Attributes Dictionary
property -
ExtraElements
ExtraElements Dictionary
property -
Text
String Value
property -
ElementName
Element Name
property -
– initWithElement:
Main initializer.
-
+ entityWithElement:
Quick allocation and initialization of the entity
-
– parseElement:
Parse XML Element that represents this object.
Other Methods
Properties
ElementName
Element Name
@property (nonatomic, readonly) NSString *ElementName
Discussion
Element Name
Returnes the element name for this instance.
Declared In
MBEntity.h
ExtraAttributes
Extra Attributes Dictionary
@property (nonatomic, readonly) NSDictionary *ExtraAttributes
Discussion
Extra Attributes Dictionary
Keys and Values are NSString objects.
Declared In
MBEntity.h
ExtraElements
ExtraElements Dictionary
@property (nonatomic, readonly) NSDictionary *ExtraElements
Discussion
ExtraElements Dictionary
Keys are NSString with the element name. Values are MBEntity or NSString objects.
Declared In
MBEntity.h
Text
String Value
@property (nonatomic, readonly) NSString *Text
Discussion
String Value
The string value enclosed within an element. This is not the XML string value. Subclasses that explicity have a value will have a property Value with the correct type: string, number, etc.
Declared In
MBEntity.h
Class Methods
entityWithElement:
Quick allocation and initialization of the entity
+ (id)entityWithElement:(NSXMLElement *)element
Parameters
- element
XML Element this object represents. If element is nil, nil is returned
Discussion
Quick allocation and initialization of the entity
Inits the entity with the XML element it represents
Declared In
MBEntity.h
Instance Methods
initWithElement:
Main initializer.
- (id)initWithElement:(NSXMLElement *)element
Parameters
- element
XML Element this object represents. If element is nil, nil is returned
Discussion
Main initializer.
Inits the entity with the XML element it represents
Declared In
MBEntity.h
parseElement:
Parse XML Element that represents this object.
- (void)parseElement:(NSXMLElement *)element
Parameters
- element
NSXMLElement (DDXMLElement on iOS) that corresponds to this object
Discussion
Parse XML Element that represents this object.
This method will iterate through every attribute and element in the XML data
that corresponds to this object. It will call set<key>:
for every attribute
and element where key is the the the local name of the attribute or element.
If set<key>:
is not defined by the subclass, the attribute or element will
be added to ExtraAttributes or ExtraElements. Using @synthesize
is fine for
attributes as the passed value will always be an NSString or NSNull type but
is not adequate for elements because the value passed will be the
NSXMLElement (DDXMLElement on iOS) for that element.
Declared In
MBEntity.h