diff --git a/AttributeTests.m b/AttributeTests.m index b7e15f0..b5b6707 100644 --- a/AttributeTests.m +++ b/AttributeTests.m @@ -31,8 +31,8 @@ - (void)testAttributedText { STAssertEquals(atts.count, 2U, nil); STAssertTrue([atts containsObject:@"count"], nil); STAssertTrue([atts containsObject:@"style"], nil); - - RXMLElement *squarexml = [rxml child:@"square"]; + + RXMLElement *squarexml = [rxml childElementWithTag:@"square"]; atts = [squarexml attributeNames]; STAssertEquals(atts.count, 3U, nil); STAssertTrue([atts containsObject:@"name"], nil); diff --git a/RaptureXML.xcodeproj/project.pbxproj b/RaptureXML.xcodeproj/project.pbxproj index 580da9f..79dc38f 100644 --- a/RaptureXML.xcodeproj/project.pbxproj +++ b/RaptureXML.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 02ADE6A916A0E491008643D5 /* EncodingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 02F3A4041526D7BC00E8C822 /* EncodingTests.m */; }; 02ADE6AA16A0E491008643D5 /* XPathTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 027B6BCF153C652E00A4EDF2 /* XPathTests.m */; }; 02F3A3FF1526D22600E8C822 /* players.xml in Resources */ = {isa = PBXBuildFile; fileRef = 0DEB8F2D14681BD800024989 /* players.xml */; }; + 0C407E54187AD99100050661 /* RXMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 027DAC2E14FBF443001BA563 /* RXMLElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; 0DEB8EB51467EC9B00024989 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0252B2C5142ADFC60018B75D /* Foundation.framework */; }; 0DEB8F2C14681A9400024989 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0252B305142AE3FF0018B75D /* libz.dylib */; }; 5415BE4216FC638100AFC566 /* HTMLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5415BE4116FC638100AFC566 /* HTMLTests.m */; }; @@ -208,6 +209,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 0C407E54187AD99100050661 /* RXMLElement.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -255,7 +257,7 @@ 0252B2B6142ADFC60018B75D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0500; ORGANIZATIONNAME = "Rapture In Venice"; }; buildConfigurationList = 0252B2B9142ADFC60018B75D /* Build configuration list for PBXProject "RaptureXML" */; @@ -375,8 +377,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -391,11 +394,15 @@ ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.3; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; @@ -404,8 +411,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -413,9 +421,12 @@ COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.3; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; @@ -437,8 +448,6 @@ GCC_VERSION = ""; HEADER_SEARCH_PATHS = "\"$(SDK_DIR)\"/usr/include/libxml2/**"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_AFTER_BUILD = YES; - TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = octest; }; name = Debug; @@ -456,8 +465,6 @@ GCC_VERSION = ""; HEADER_SEARCH_PATHS = "\"$(SDK_DIR)\"/usr/include/libxml2/**"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_AFTER_BUILD = YES; - TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = octest; }; name = Release; @@ -489,6 +496,7 @@ "\"$(SRCROOT)/../WordsWithPractice/WordsWithPractice/GoogleAdMobAdsSDK\"", ); PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "include/$(PRODUCT_NAME)"; SKIP_INSTALL = YES; }; name = Debug; @@ -520,6 +528,7 @@ "\"$(SRCROOT)/../WordsWithPractice/WordsWithPractice/GoogleAdMobAdsSDK\"", ); PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "include/$(PRODUCT_NAME)"; SKIP_INSTALL = YES; }; name = Release; diff --git a/RaptureXML/RXMLElement.h b/RaptureXML/RXMLElement.h index 6bc81a0..b9326b4 100644 --- a/RaptureXML/RXMLElement.h +++ b/RaptureXML/RXMLElement.h @@ -29,11 +29,9 @@ // #import -#import -#import -#import -#import -#import + +typedef struct _xmlDoc *xmlDocPtr;/* frorward declaration */ +typedef struct _xmlNode *xmlNodePtr; /* frorward declaration */ @interface RXMLDocHolder : NSObject { xmlDocPtr doc_; @@ -87,14 +85,14 @@ - (double)attributeAsDouble:(NSString *)attributeName; - (double)attributeAsDouble:(NSString *)attributeName inNamespace:(NSString *)ns; -- (RXMLElement *)child:(NSString *)tag; -- (RXMLElement *)child:(NSString *)tag inNamespace:(NSString *)ns; +- (RXMLElement *)childElementWithTag:(NSString *)tag; +- (RXMLElement *)childElementWithTag:(NSString *)tag inNamespace:(NSString *)ns; -- (NSArray *)children:(NSString *)tag; -- (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns; -- (NSArray *)childrenWithRootXPath:(NSString *)xpath; +- (NSArray *)childrenArrayWithTag:(NSString *)tag; +- (NSArray *)childrenArrayWithTag:(NSString *)tag inNamespace:(NSString *)ns; +- (NSArray *)childrenArrayWithRootXPath:(NSString *)xpath; -- (void)iterate:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk; +- (void)iterateWithQuery:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk; - (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(RXMLElement *))blk; - (void)iterateElements:(NSArray *)elements usingBlock:(void (^)(RXMLElement *))blk; diff --git a/RaptureXML/RXMLElement.m b/RaptureXML/RXMLElement.m index eaf0733..fa91e3d 100644 --- a/RaptureXML/RXMLElement.m +++ b/RaptureXML/RXMLElement.m @@ -29,6 +29,11 @@ // #import "RXMLElement.h" +#import +#import +#import +#import +#import @implementation RXMLDocHolder @@ -267,11 +272,7 @@ - (NSString *)attribute:(NSString *)attName { - (NSString *)attribute:(NSString *)attName inNamespace:(NSString *)ns { const unsigned char *attCStr = xmlGetNsProp(node_, (const xmlChar *)[attName cStringUsingEncoding:NSUTF8StringEncoding], (const xmlChar *)[ns cStringUsingEncoding:NSUTF8StringEncoding]); - if (attCStr) { - return [NSString stringWithUTF8String:(const char *)attCStr]; - } - - return nil; + return attCStr ? [NSString stringWithUTF8String:(const char *)attCStr] : nil; } - (NSArray *)attributeNames { @@ -306,7 +307,7 @@ - (BOOL)isValid { #pragma mark - -- (RXMLElement *)child:(NSString *)tag { +- (RXMLElement *)childElementWithTag:(NSString *)tag { NSArray *components = [tag componentsSeparatedByString:@"."]; xmlNodePtr cur = node_; @@ -336,14 +337,10 @@ - (RXMLElement *)child:(NSString *)tag { } } - if (cur) { - return [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]; - } - - return nil; + return cur ? [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur] : nil; } -- (RXMLElement *)child:(NSString *)tag inNamespace:(NSString *)ns { +- (RXMLElement *)childElementWithTag:(NSString *)tag inNamespace:(NSString *)ns { NSArray *components = [tag componentsSeparatedByString:@"."]; xmlNodePtr cur = node_; const xmlChar *namespaceC = (const xmlChar *)[ns cStringUsingEncoding:NSUTF8StringEncoding]; @@ -374,14 +371,10 @@ - (RXMLElement *)child:(NSString *)tag inNamespace:(NSString *)ns { } } - if (cur) { - return [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]; - } - - return nil; + return cur ? [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur] : nil; } -- (NSArray *)children:(NSString *)tag { +- (NSArray *)childrenArrayWithTag:(NSString *)tag { const xmlChar *tagC = (const xmlChar *)[tag cStringUsingEncoding:NSUTF8StringEncoding]; NSMutableArray *children = [NSMutableArray array]; xmlNodePtr cur = node_->children; @@ -397,7 +390,7 @@ - (NSArray *)children:(NSString *)tag { return [children copy]; } -- (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns { +- (NSArray *)childrenArrayWithTag:(NSString *)tag inNamespace:(NSString *)ns { const xmlChar *tagC = (const xmlChar *)[tag cStringUsingEncoding:NSUTF8StringEncoding]; const xmlChar *namespaceC = (const xmlChar *)[ns cStringUsingEncoding:NSUTF8StringEncoding]; NSMutableArray *children = [NSMutableArray array]; @@ -414,7 +407,7 @@ - (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns { return [children copy]; } -- (NSArray *)childrenWithRootXPath:(NSString *)xpath { +- (NSArray *)childrenArrayWithRootXPath:(NSString *)xpath { // check for a query if (!xpath) { return [NSArray array]; @@ -454,7 +447,7 @@ - (NSArray *)childrenWithRootXPath:(NSString *)xpath { #pragma mark - -- (void)iterate:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk { +- (void)iterateWithQuery:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk { // check for a query if (!query) { return; @@ -477,7 +470,7 @@ - (void)iterate:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk { if (cur->type == XML_ELEMENT_NODE) { RXMLElement *element = [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]; NSString *restOfQuery = [[components subarrayWithRange:NSMakeRange(i + 1, components.count - i - 1)] componentsJoinedByString:@"."]; - [element iterate:restOfQuery usingBlock:blk]; + [element iterateWithQuery:restOfQuery usingBlock:blk]; } cur = cur->next; @@ -528,7 +521,7 @@ - (void)iterate:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk { } - (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(RXMLElement *))blk { - NSArray *children = [self childrenWithRootXPath:xpath]; + NSArray *children = [self childrenArrayWithRootXPath:xpath]; [self iterateElements:children usingBlock:blk]; } diff --git a/Tests/BoundaryTests.m b/Tests/BoundaryTests.m index aa218ed..820dc34 100644 --- a/Tests/BoundaryTests.m +++ b/Tests/BoundaryTests.m @@ -41,7 +41,7 @@ - (void)testEmptyTopTagXML { RXMLElement *rxml = [RXMLElement elementFromXMLString:emptyTopTagXML_ encoding:NSUTF8StringEncoding]; STAssertTrue(rxml.isValid, nil); STAssertEqualObjects(rxml.text, @"", nil); - STAssertEqualObjects([rxml childrenWithRootXPath:@"*"], [NSArray array], nil); + STAssertEqualObjects([rxml childrenArrayWithRootXPath:@"*"], [NSArray array], nil); } - (void)testAttribute { @@ -60,26 +60,26 @@ - (void)testNamespaceAttribute { - (void)testChild { RXMLElement *rxml = [RXMLElement elementFromXMLString:childXML_ encoding:NSUTF8StringEncoding]; STAssertTrue(rxml.isValid, nil); - STAssertEqualObjects([rxml child:@"empty_child"].text, @"", nil); - STAssertEqualObjects([rxml child:@"text_child"].text, @"foo", nil); + STAssertEqualObjects([rxml childElementWithTag:@"empty_child"].text, @"", nil); + STAssertEqualObjects([rxml childElementWithTag:@"text_child"].text, @"foo", nil); } - (void)testNamespaceChild { RXMLElement *rxml = [RXMLElement elementFromXMLString:namespaceXML_ encoding:NSUTF8StringEncoding]; STAssertTrue(rxml.isValid, nil); - STAssertEqualObjects([rxml child:@"text" inNamespace:@"*"].text, @"something", nil); + STAssertEqualObjects([rxml childElementWithTag:@"text" inNamespace:@"*"].text, @"something", nil); } - (void)testChildren { RXMLElement *rxml = [RXMLElement elementFromXMLString:childrenXML_ encoding:NSUTF8StringEncoding]; STAssertTrue(rxml.isValid, nil); - STAssertEquals([rxml children:@"child"].count, 3U, nil); + STAssertEquals([rxml childrenArrayWithTag:@"child"].count, 3U, nil); } - (void)testNamespaceChildren { RXMLElement *rxml = [RXMLElement elementFromXMLString:namespaceXML_ encoding:NSUTF8StringEncoding]; STAssertTrue(rxml.isValid, nil); - STAssertEquals([rxml children:@"text" inNamespace:@"*"].count, 1U, nil); + STAssertEquals([rxml childrenArrayWithTag:@"text" inNamespace:@"*"].count, 1U, nil); } @end diff --git a/Tests/CopyTests.m b/Tests/CopyTests.m index 92d43c8..e99410d 100644 --- a/Tests/CopyTests.m +++ b/Tests/CopyTests.m @@ -55,7 +55,7 @@ - (void)testTags { RXMLElement *rxml2 = [rxml copy]; __block NSInteger i = 0; - [rxml2 iterate:@"*" usingBlock:^(RXMLElement *e) { + [rxml2 iterateWithQuery:@"*" usingBlock:^(RXMLElement *e) { if (i == 0) { STAssertEqualObjects(e.tag, @"square", nil); STAssertEqualObjects(e.text, @"Square", nil); @@ -78,7 +78,7 @@ - (void)testAttributes { RXMLElement *rxml2 = [rxml copy]; __block NSInteger i = 0; - [rxml2 iterate:@"*" usingBlock:^(RXMLElement *e) { + [rxml2 iterateWithQuery:@"*" usingBlock:^(RXMLElement *e) { if (i == 0) { STAssertEqualObjects([e attribute:@"name"], @"Square", nil); } else if (i == 1) { diff --git a/Tests/DeepChildrenTests.m b/Tests/DeepChildrenTests.m index 7579b96..b451d63 100644 --- a/Tests/DeepChildrenTests.m +++ b/Tests/DeepChildrenTests.m @@ -22,8 +22,8 @@ - (void)testQuery { __block NSInteger i = 0; // count the players - RXMLElement *players = [rxml child:@"players"]; - NSArray *children = [players children:@"player"]; + RXMLElement *players = [rxml childElementWithTag:@"players"]; + NSArray *children = [players childrenArrayWithTag:@"player"]; [rxml iterateElements:children usingBlock: ^(RXMLElement *e) { i++; @@ -36,7 +36,7 @@ - (void)testDeepChildQuery { RXMLElement *rxml = [RXMLElement elementFromXMLFile:@"players.xml"]; // count the players - RXMLElement *coachingYears = [rxml child:@"players.coach.experience.years"]; + RXMLElement *coachingYears = [rxml childElementWithTag:@"players.coach.experience.years"]; STAssertEquals(coachingYears.textAsInt, 1, nil); } @@ -45,7 +45,7 @@ - (void)testDeepChildQueryWithWildcard { RXMLElement *rxml = [RXMLElement elementFromXMLFile:@"players.xml"]; // count the players - RXMLElement *coachingYears = [rxml child:@"players.coach.experience.teams.*"]; + RXMLElement *coachingYears = [rxml childElementWithTag:@"players.coach.experience.teams.*"]; // first team returned STAssertEquals(coachingYears.textAsInt, 53, nil); diff --git a/Tests/DeepTests.m b/Tests/DeepTests.m index f595091..cdab23d 100644 --- a/Tests/DeepTests.m +++ b/Tests/DeepTests.m @@ -24,7 +24,7 @@ - (void)testQuery { // count the players i = 0; - [rxml iterate:@"players.player" usingBlock: ^(RXMLElement *e) { + [rxml iterateWithQuery:@"players.player" usingBlock: ^(RXMLElement *e) { i++; }]; @@ -33,7 +33,7 @@ - (void)testQuery { // count the first player's name i = 0; - [rxml iterate:@"players.player.name" usingBlock: ^(RXMLElement *e) { + [rxml iterateWithQuery:@"players.player.name" usingBlock: ^(RXMLElement *e) { i++; }]; @@ -42,7 +42,7 @@ - (void)testQuery { // count the coaches i = 0; - [rxml iterate:@"players.coach" usingBlock: ^(RXMLElement *e) { + [rxml iterateWithQuery:@"players.coach" usingBlock: ^(RXMLElement *e) { i++; }]; diff --git a/Tests/ErrorTests.m b/Tests/ErrorTests.m index c6370c2..85783fe 100644 --- a/Tests/ErrorTests.m +++ b/Tests/ErrorTests.m @@ -36,7 +36,7 @@ - (void)testBadXML { - (void)testMissingTag { RXMLElement *rxml = [RXMLElement elementFromXMLString:simplifiedXML_ encoding:NSUTF8StringEncoding]; - RXMLElement *hexagon = [rxml child:@"hexagon"]; + RXMLElement *hexagon = [rxml childElementWithTag:@"hexagon"]; STAssertNil(hexagon, nil); } @@ -45,7 +45,7 @@ - (void)testMissingTagIteration { RXMLElement *rxml = [RXMLElement elementFromXMLString:simplifiedXML_ encoding:NSUTF8StringEncoding]; __block NSInteger i = 0; - [rxml iterate:@"hexagon" usingBlock:^(RXMLElement *e) { + [rxml iterateWithQuery:@"hexagon" usingBlock:^(RXMLElement *e) { i++; }]; diff --git a/Tests/HTMLTests.m b/Tests/HTMLTests.m index 8f1552e..8f51f96 100644 --- a/Tests/HTMLTests.m +++ b/Tests/HTMLTests.m @@ -34,7 +34,7 @@ - (void)testBasicXHTML { NSArray *atts = [html attributeNames]; STAssertEquals(atts.count, 2U, nil); - NSArray* children = [html childrenWithRootXPath:@"//html/body/p"]; + NSArray* children = [html childrenArrayWithRootXPath:@"//html/body/p"]; STAssertTrue([children count] > 0, nil); RXMLElement* child = [children objectAtIndex:0]; diff --git a/Tests/SimpleTests.m b/Tests/SimpleTests.m index c6f6463..d752fa7 100644 --- a/Tests/SimpleTests.m +++ b/Tests/SimpleTests.m @@ -55,7 +55,7 @@ - (void)testTags { RXMLElement *rxml = [RXMLElement elementFromXMLString:simplifiedXML_ encoding:NSUTF8StringEncoding]; __block NSInteger i = 0; - [rxml iterate:@"*" usingBlock:^(RXMLElement *e) { + [rxml iterateWithQuery:@"*" usingBlock:^(RXMLElement *e) { if (i == 0) { STAssertEqualObjects(e.tag, @"square", nil); STAssertEqualObjects(e.text, @"Square", nil); @@ -77,7 +77,7 @@ - (void)testAttributes { RXMLElement *rxml = [RXMLElement elementFromXMLString:attributedXML_ encoding:NSUTF8StringEncoding]; __block NSInteger i = 0; - [rxml iterate:@"*" usingBlock:^(RXMLElement *e) { + [rxml iterateWithQuery:@"*" usingBlock:^(RXMLElement *e) { if (i == 0) { STAssertEqualObjects([e attribute:@"name"], @"Square", nil); } else if (i == 1) { @@ -99,11 +99,11 @@ -(void) testInnerXml { "; RXMLElement *rxml = [RXMLElement elementFromXMLString:treeXML_ encoding:NSUTF8StringEncoding]; - RXMLElement* shapes = [rxml child:@"shapes"]; + RXMLElement* shapes = [rxml childElementWithTag:@"shapes"]; STAssertEqualObjects(shapes.xml, @"Circle", nil); STAssertEqualObjects(shapes.innerXml, @"Circle", nil); - RXMLElement* colors = [rxml child:@"colors"]; + RXMLElement* colors = [rxml childElementWithTag:@"colors"]; STAssertEqualObjects(colors.xml, @"TESTBlackdefault color", nil); STAssertEqualObjects(colors.innerXml, @"TESTBlackdefault color", nil); diff --git a/Tests/TextConversionTests.m b/Tests/TextConversionTests.m index 9c98ef3..db0f2f7 100644 --- a/Tests/TextConversionTests.m +++ b/Tests/TextConversionTests.m @@ -47,11 +47,11 @@ - (void)testIntTags { RXMLElement *rxml = [RXMLElement elementFromXMLString:simplifiedXML_ encoding:NSUTF8StringEncoding]; __block NSInteger i = 0; - [rxml iterate:@"*" usingBlock:^(RXMLElement *e) { + [rxml iterateWithQuery:@"*" usingBlock:^(RXMLElement *e) { if (i == 0) { - STAssertEquals([e child:@"id"].textAsInt, 1, nil); + STAssertEquals([e childElementWithTag:@"id"].textAsInt, 1, nil); } else if (i == 1) { - STAssertEqualsWithAccuracy([e child:@"id"].textAsDouble, 2.5, 0.01, nil); + STAssertEqualsWithAccuracy([e childElementWithTag:@"id"].textAsDouble, 2.5, 0.01, nil); } i++; @@ -62,7 +62,7 @@ - (void)testIntAttributes { RXMLElement *rxml = [RXMLElement elementFromXMLString:attributedXML_ encoding:NSUTF8StringEncoding]; __block NSInteger i = 0; - [rxml iterate:@"*" usingBlock:^(RXMLElement *e) { + [rxml iterateWithQuery:@"*" usingBlock:^(RXMLElement *e) { if (i == 0) { STAssertEquals([e attributeAsInt:@"id"], 1, nil); } else if (i == 1) { diff --git a/Tests/WildcardTests.m b/Tests/WildcardTests.m index 1819c98..d3a2845 100644 --- a/Tests/WildcardTests.m +++ b/Tests/WildcardTests.m @@ -24,7 +24,7 @@ - (void)testEndingWildcard { // count the players and coaches i = 0; - [rxml iterate:@"players.*" usingBlock: ^(RXMLElement *e) { + [rxml iterateWithQuery:@"players.*" usingBlock: ^(RXMLElement *e) { i++; }]; @@ -38,7 +38,7 @@ - (void)testMidstreamWildcard { // count the tags that have a name i = 0; - [rxml iterate:@"players.*.name" usingBlock: ^(RXMLElement *e) { + [rxml iterateWithQuery:@"players.*.name" usingBlock: ^(RXMLElement *e) { i++; }]; @@ -47,7 +47,7 @@ - (void)testMidstreamWildcard { // count the tags that have a position i = 0; - [rxml iterate:@"players.*.position" usingBlock: ^(RXMLElement *e) { + [rxml iterateWithQuery:@"players.*.position" usingBlock: ^(RXMLElement *e) { i++; }];