Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions XMLReader.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,23 @@ @implementation XMLReader

+ (NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError **)error
{
XMLReader *reader = [[XMLReader alloc] initWithError:error];
NSDictionary *rootDictionary = [reader objectWithData:data options:0];
return rootDictionary;
return [[self class] dictionaryForXMLData:data options:0 error:error];
}

+ (NSDictionary *)dictionaryForXMLString:(NSString *)string error:(NSError **)error
{
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
return [XMLReader dictionaryForXMLData:data error:error];
return [XMLReader dictionaryForXMLData:data options:0 error:error];
}

+ (NSDictionary *)dictionaryForXMLData:(NSData *)data options:(XMLReaderOptions)options error:(NSError **)error
{
XMLReader *reader = [[XMLReader alloc] initWithError:error];
NSDictionary *rootDictionary = [reader objectWithData:data options:options];
if (!rootDictionary && error)
{
*error = reader.errorPointer;
}
return rootDictionary;
}

Expand All @@ -59,10 +61,10 @@ + (NSDictionary *)dictionaryForXMLString:(NSString *)string options:(XMLReaderOp

- (id)initWithError:(NSError **)error
{
self = [super init];
self = [super init];
if (self)
{
self.errorPointer = *error;
self.errorPointer = (error ? *error : nil);
}
return self;
}
Expand Down