44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
root = [OFXMLElement elementWithXMLString: self];
} @catch (OFMalformedXMLException *e) {
@throw [OFInvalidArgumentException exception];
} @catch (OFUnboundNamespaceException *e) {
@throw [OFInvalidArgumentException exception];
}
version = [[root attributeForName: @"version"] stringValue];
if (version == nil)
@throw [OFInvalidArgumentException exception];
if ([version decimalValue] != 1)
@throw [OFUnsupportedVersionException
exceptionWithVersion: version];
elements = [root elementsForNamespace: OF_SERIALIZATION_NS];
if ([elements count] != 1)
@throw [OFInvalidArgumentException exception];
object = [[[elements firstObject] objectByDeserializing] retain];
objc_autoreleasePoolPop(pool);
return [object autorelease];
}
@end
|
|
|
|
|
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
root = [OFXMLElement elementWithXMLString: self];
} @catch (OFMalformedXMLException *e) {
@throw [OFInvalidArgumentException exception];
} @catch (OFUnboundNamespaceException *e) {
@throw [OFInvalidArgumentException exception];
}
version = [root attributeForName: @"version"].stringValue;
if (version == nil)
@throw [OFInvalidArgumentException exception];
if (version.decimalValue != 1)
@throw [OFUnsupportedVersionException
exceptionWithVersion: version];
elements = [root elementsForNamespace: OF_SERIALIZATION_NS];
if (elements.count != 1)
@throw [OFInvalidArgumentException exception];
object = [[elements.firstObject objectByDeserializing] retain];
objc_autoreleasePoolPop(pool);
return [object autorelease];
}
@end
|