Skip to content

Commit

Permalink
[Issue #6] Minor changes to accomodate OS X 10.6 / iOS 4.3 deployment…
Browse files Browse the repository at this point in the history
… target
  • Loading branch information
mattt committed Mar 11, 2014
1 parent 85b60e4 commit c1df37d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
12 changes: 10 additions & 2 deletions Example/Ono Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
F8301EA018CF199900085EC9 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F8301E9F18CF199900085EC9 /* libxml2.dylib */; };
F897F97A18BFC44E0043A736 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F897F97918BFC44E0043A736 /* Foundation.framework */; };
F897F97D18BFC44E0043A736 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F897F97C18BFC44E0043A736 /* main.m */; };
F897F98B18BFC4CE0043A736 /* ONOXMLDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = F897F98A18BFC4CE0043A736 /* ONOXMLDocument.m */; };
F897F99018BFC5860043A736 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F897F98F18BFC5860043A736 /* libxml2.dylib */; };
F897F99D18BFCC9A0043A736 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F897F99C18BFCC9A0043A736 /* XCTest.framework */; };
F897F9A318BFCC9A0043A736 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F897F9A118BFCC9A0043A736 /* InfoPlist.strings */; };
F897F9A518BFCC9A0043A736 /* ONOXMLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F897F9A418BFCC9A0043A736 /* ONOXMLTests.m */; };
Expand Down Expand Up @@ -44,6 +44,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
F8301E9D18CF198F00085EC9 /* libxml2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.2.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libxml2.2.dylib; sourceTree = DEVELOPER_DIR; };
F8301E9F18CF199900085EC9 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libxml2.dylib; sourceTree = DEVELOPER_DIR; };
F897F97618BFC44E0043A736 /* Ono Example */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Ono Example"; sourceTree = BUILT_PRODUCTS_DIR; };
F897F97918BFC44E0043A736 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
F897F97C18BFC44E0043A736 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ../main.m; sourceTree = "<group>"; };
Expand All @@ -68,7 +70,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F897F99018BFC5860043A736 /* libxml2.dylib in Frameworks */,
F8301EA018CF199900085EC9 /* libxml2.dylib in Frameworks */,
F897F97A18BFC44E0043A736 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -108,6 +110,8 @@
F897F97818BFC44E0043A736 /* Frameworks */ = {
isa = PBXGroup;
children = (
F8301E9F18CF199900085EC9 /* libxml2.dylib */,
F8301E9D18CF198F00085EC9 /* libxml2.2.dylib */,
F897F98F18BFC5860043A736 /* libxml2.dylib */,
F897F97918BFC44E0043A736 /* Foundation.framework */,
F897F99C18BFCC9A0043A736 /* XCTest.framework */,
Expand Down Expand Up @@ -386,7 +390,9 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SDK_DIR)\"/usr/include/libxml2",
);
MACOSX_DEPLOYMENT_TARGET = 10.6;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx10.7;
};
name = Debug;
};
Expand All @@ -400,7 +406,9 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SDK_DIR)\"/usr/include/libxml2",
);
MACOSX_DEPLOYMENT_TARGET = 10.6;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx10.7;
};
name = Release;
};
Expand Down
22 changes: 15 additions & 7 deletions Ono/ONOXMLDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ - (NSNumberFormatter *)numberFormatter {
- (NSDateFormatter *)dateFormatter {
if (!_dateFormatter) {
_dateFormatter = [[NSDateFormatter alloc] init];
[_dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
[_dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
[_dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
}

Expand Down Expand Up @@ -397,7 +397,7 @@ - (NSDictionary *)attributes {
xmlAttrPtr attribute = self.xmlNode->properties;
while (attribute) {
NSString *key = [NSString stringWithUTF8String:(const char *)attribute->name];
mutableAttributes[key] = [self valueForAttribute:key];
[mutableAttributes setObject:[self valueForAttribute:key] forKey:key];
attribute = attribute->next;
}

Expand Down Expand Up @@ -452,10 +452,16 @@ - (ONOXMLElement *)firstChildWithTag:(NSString *)tag {
- (ONOXMLElement *)firstChildWithTag:(NSString *)tag
inNamespace:(NSString *)namespace
{
return [[self childrenAtIndexes:[self indexesOfChildrenPassingTest:^BOOL(xmlNodePtr node, BOOL *stop) {
NSArray *children = [self childrenAtIndexes:[self indexesOfChildrenPassingTest:^BOOL(xmlNodePtr node, BOOL *stop) {
*stop = ONOXMLNodeMatchesTagInNamespace(node, tag, namespace);
return *stop;
}]] firstObject];
}]];

if ([children count] == 0) {
return nil;
}

return [children objectAtIndex:0];
}

- (NSArray *)childrenWithTag:(NSString *)tag {
Expand Down Expand Up @@ -565,7 +571,7 @@ - (id)objectForKeyedSubscript:(id)key {
}

- (id)objectAtIndexedSubscript:(NSUInteger)idx {
return self.children[idx];
return [self.children objectAtIndex:idx];
}

#pragma mark - NSObject
Expand Down Expand Up @@ -604,9 +610,11 @@ - (NSUInteger)hash {

ONOXPathEnumerator *enumerator = nil;
xmlXPathContextPtr context = xmlXPathNewContext(self.xmlNode->doc);
xmlXPathSetContextNode(self.xmlNode, context);
if (context) {
enumerator = [self.document enumeratorWithXPathObject:xmlXPathEvalExpression((xmlChar *)[XPath cStringUsingEncoding:NSUTF8StringEncoding], context)];
context->node = self.xmlNode;

xmlXPathObjectPtr xmlXPath = xmlXPathEvalExpression((xmlChar *)[XPath cStringUsingEncoding:NSUTF8StringEncoding], context);
enumerator = [self.document enumeratorWithXPathObject:xmlXPath];

xmlXPathFreeContext(context);
}
Expand Down

0 comments on commit c1df37d

Please sign in to comment.