Crash inside -[ONOXMLElement attributes] for "description" key
chrisballinger opened this issue · 3 comments
chrisballinger commented
- (NSDictionary *)attributes {
if (!_attributes) {
NSMutableDictionary *mutableAttributes = [NSMutableDictionary dictionary];
for (xmlAttrPtr attribute = self.xmlNode->properties; attribute != NULL; attribute = attribute->next) {
NSString *key = @((const char *)attribute->name);
// valueForAttribute is nil for 'description'
[mutableAttributes setObject:[self valueForAttribute:key] forKey:key];
}
self.attributes = [NSDictionary dictionaryWithDictionary:mutableAttributes];
}
return _attributes;
}
Sample:
<outline text="BBC Persian" description="<div style="direction:rtl;text-align:right">این صفحه دیگر به روخ.." htmlUrl="http://www.bbc.co.uk/blogs/persian/editors/" xmlUrl="http://www.bbc.co.uk/blogs/persian/editors/rss.xml" subscribe="false" content_type="text/xml" site_icon="http://www.bbc.co.uk/favicon.ico"/>
cezheng commented
@chrisballinger I tried parsing this xml but were not able to reproduce it. Would you mind sharing the whole xml file and the code?
mattt commented
Hi, @chrisballinger. Sorry for not responding sooner.
I can't reproduce this either. If you're still having this issue, please submit a PR with a failing test case, and I'd be more than happy to look into it for you.
LinkRober commented
I have same issue.
this will produce
- (LeMobileTemplateItem *)createTemplateItemWithData:(NSDictionary *)data {
ONOXMLDocument *doc = [ONOXMLDocument XMLDocumentWithString:self.xmlElementString encoding:NSUTF8StringEncoding error:nil];
ONOXMLElement *childElement = doc;
LeMobileTemplateItem *templateItem = [[LeMobileTemplateItem alloc] initWithXmlElement:childElement.children.firstObject data:data controllerClass:self.controllerClass];
return templateItem;
}
but code below not
- (LeMobileTemplateItem *)createTemplateItemWithData:(NSDictionary *)data {
// ONOXMLDocument *doc = [ONOXMLDocument XMLDocumentWithString:self.xmlElementString encoding:NSUTF8StringEncoding error:nil];
ONOXMLElement *childElement = self.doc.rootElement;
LeMobileTemplateItem *templateItem = [[LeMobileTemplateItem alloc] initWithXmlElement:childElement.children.firstObject data:data controllerClass:self.controllerClass];
return templateItem;
}
I think, it is bad pointer