robbiehanson/KissXML — Issue #11: DDXMLNode attributeForName fails after ARC Conversion
Author: kazapp
Created: 2011-12-31 23:14:46+00:00
State: open

The code below compel;lied and ran fine before converting to ARC and using the new KISSXML 5.0 libraries updated for ARC. I now get an error when compiling the ARC project at these lines:

DDXMLNode *attrRecSeqNoName = [node attributeForName:@"recSeqNo"];

ERROR is:
Automatic Reference Counting Issue:
Receiver type 'DDXMLNode' for instance message does not declare a method with selector 'attributeForName:'

Hope you can help me.

CODE SNIPPET:

DDXMLDocument *doc = [[DDXMLDocument alloc] initWithData:xmlData options:0 error:nil];
NSArray *items = [doc nodesForXPath:@"//block/*" error:nil];

for (DDXMLElement *item in items)
{

for (int i = 0; i < [item childCount]; i++) //START LOOP
{
DDXMLNode *node = [item childAtIndex:i];

name = [node name];
value = [node stringValue];

if ([name isEqualToString:@"recordBnr"])
{

DDXMLNode *attrRecSeqNoName = [node attributeForName:@"recSeqNo"];
NSString *attrRecSeqNo = [attrRecSeqNoName XMLString];
DDXMLNode *attrLimitMaxName = [node attributeForName:@"limitMax"];
NSString *attrLimitMax = [attrLimitMaxName stringValue];
DDXMLNode *attrLimitMinName = [node attributeForName:@"limitMin"];
NSString *attrLimitMin= [attrLimitMinName stringValue];

NSLog(@"attrRecSeqNo = %@", attrRecSeqNo);
NSLog(@"attrLimitMin = %@", attrLimitMin);
NSLog(@"attrLimitMax = %@", attrLimitMax);
}
}
}