I am currently trying to get my parser delegates to work with a custom NSObject
I have created for the attributes of the xml I am receiving..
This is the XML that is being read in to my parser delegates
<Rows>
<Row SKATERID="706" MANUFACTURER="GAZ" ISFACT="F" ISSKATE="F"/>
<Row SKATERID="318" MANUFACTURER="MAN" ISFACT="F" ISSKATE="T"/>
//...
</Rows>
This is what I have for my -parser:didStartElement:namespaceURI:qualifiedName:attributes:
method:
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
if ( [elementName isEqualToString:@"Row"]) {
manufactureNSObject = [[ManufactureNSObject alloc] init];
manufactureNSObject.ISFACT = [attributeDict objectForKey:@"ISFACT"];
manufactureNSObject.ISSKATE = [attributeDict objectForKey:@"ISSKATE"];
manufactureNSObject.MANUFACTURER = [attributeDict objectForKey:@"MANUFACTURER"];
manufactureNSObject.SKATERID = [attributeDict objectForKey:@"SKATERID"];
NSLog(@"%@ %@ %@ %@", manufactureNSObject.ISFACT, manufactureNSObject.ISSKATE, manufactureNSObject.MANUFACTURER, manufactureNSObject.SKATERID);
}
}
My NSLog
prints out all of the correct values fine, the next part that I am stuck on is the
- parser:didEndElement:namespaceURI:qualifiedName:
method, nothing apart from the didEndElement
is coming through correctly... this is what I have for that method.
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
NSLog(@"%@", elementName);
NSLog(@"%@", namespaceURI);
NSLog(@"%@", qName);
}
This is what my output looks like from the NSLog
s.
2011-10-13 10:04:16.529 Code[52605:207] F F GAZ 76
2011-10-13 10:04:16.531 Code[52605:207] Row
2011-10-13 10:04:16.535 Code[52605:207] (null)
2011-10-13 10:04:16.537 Code[52605:207] (null)
2011-10-13 10:04:16.537 Code[52605:207] F T MAN 38
2011-10-13 10:04:16.538 Code[52605:207] Row
2011-10-13 10:04:16.539 Code[52605:207] (null)
2011-10-13 10:04:16.540 Code[52605:207] (null)
I specifically would like help with trying to complete the second method and get this all working correctly.
All the help so far has been greatly appreciated.