54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
@try {
void *pool = objc_autoreleasePoolPush();
OFXMLAttribute *targetAttr;
if (![element.name isEqual: self.className] ||
![element.namespace isEqual: OF_SERIALIZATION_NS])
@throw [OFInvalidArgumentException exception];
targetAttr = [element attributeForName: @"target"
namespace: OF_SERIALIZATION_NS];
if (targetAttr.stringValue.length == 0)
@throw [OFInvalidArgumentException exception];
self = [self initWithTarget: targetAttr.stringValue
data: element.stringValue];
objc_autoreleasePoolPop(pool);
|
|
|
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
@try {
void *pool = objc_autoreleasePoolPush();
OFXMLAttribute *targetAttr;
if (![element.name isEqual: self.className] ||
![element.namespace isEqual: OFSerializationNS])
@throw [OFInvalidArgumentException exception];
targetAttr = [element attributeForName: @"target"
namespace: OFSerializationNS];
if (targetAttr.stringValue.length == 0)
@throw [OFInvalidArgumentException exception];
self = [self initWithTarget: targetAttr.stringValue
data: element.stringValue];
objc_autoreleasePoolPop(pool);
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
{
return self.XMLString;
}
- (OFXMLElement *)XMLElementBySerializing
{
OFXMLElement *ret = [OFXMLElement elementWithName: self.className
namespace: OF_SERIALIZATION_NS
stringValue: _data];
void *pool = objc_autoreleasePoolPush();
[ret addAttribute: [OFXMLAttribute attributeWithName: @"target"
stringValue: _target]];
objc_autoreleasePoolPop(pool);
return ret;
}
@end
|
|
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
{
return self.XMLString;
}
- (OFXMLElement *)XMLElementBySerializing
{
OFXMLElement *ret = [OFXMLElement elementWithName: self.className
namespace: OFSerializationNS
stringValue: _data];
void *pool = objc_autoreleasePoolPush();
[ret addAttribute: [OFXMLAttribute attributeWithName: @"target"
stringValue: _target]];
objc_autoreleasePoolPop(pool);
return ret;
}
@end
|