I'm having strange problems parsing (apparently) correct XML code!
The xml parsed is:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<results>
<file id="0" name=" Linux Ubuntu.rar 700.64 2" size="700" disp="2"/>
<file id="1" name=" [Soft] Sistema operativo Linux. Live CD Distro Ubuntu-5.04-live-i386.iso 624.926 4" size="5" disp="4"/>
<file id="2" name=" ubuntu-9.04-server-i386.iso 577.220 2" size="9" disp="2"/>
<file id="3" name=" virtualbox-3.1_3.1.2-56127_Ubuntu_karmic_amd64.deb 43.578 1" size="3" disp="1"/>
<file id="4" name=" [APP-ITA].UBUNTU.LINUX.iso 586.822 2" size="586" disp="2"/>
<file id="5" name=" Ubuntu linux 2007.iso 700.446 1" size="700" disp="1"/>
<file id="6" name=" Installare aMule Adunanza + Liste Server + Liste Nodi su Ubuntu Gutsy [Fastweb 0.72 5" size="0" disp="5"/>
<file id="7" name=" - Guida Per Linux Ubuntu 7.03 Facile Da Usare!!!!!!!La Prima In Ita.rar 731.351 3" size="7" disp="3"/>
<file id="8" name=" Ubuntu Hacks - Tips and Tools for Exploring, Using, and Tuning Linux (O'Reilly, 3.494 1" size="3" disp="1"/>
<file id="9" name=" Linux-ubuntu-8.04.1-desktop-i386.iso 694.498 3" size="8" disp="3"/>
<file id="10" name=" [MANUALE] Ubuntu Linux - Computer Magazine.pdf 86.992 2" size="86" disp="2"/>
<file id="11" name=" (Ebook - Ita - Software) Ubuntu - Desktop Guide.pdf 0.686 3" size="0" disp="3"/>
<file id="12" name=" Installare Amule Adunanza In Ubuntu.rar 0.25 6" size="0" disp="6"/>
<file id="13" name=" UBUNTU LINUX [ITA].PDF 0.536 62" size="0" disp="62"/>
<file id="14" name=" Comandi Fondamentali Ubuntu.rtf 0.67 4" size="0" disp="4"/>
<file id="15" name=" ubuntu Guida.tar 0.160 1" size="0" disp="1"/>
<file id="16" name=" ubuntu-remix-italiano-8.10.iso 702.720 1" size="8" disp="1"/>
</results>
</root>
NSXMLParser gives me the following error:
2010-01-13 20:23:22.500 iMule[1419:20b] Error 65, Description: (null), Line: 13, Column: 24
2010-01-13 20:23:22.516 iMule[1419:20b] Error 4, Description: (null), Line: 1, Column: 1
The funny thing is that, if i parse these lines singularly i have no problems, the parser dosent fuss at all!
My parsing code is:
// DELEGATE XML PARSER
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{
if([elementName isEqualToString:@"downloads"] || [elementName isEqualToString:@"results"]){
NSLog(@"starting or downloads or results");
if(xmlArray){
xmlArray= nil;
}
self.xmlArray= [[NSMutableArray alloc] init];
if([elementName isEqualToString:@"results"]){
[self.results_controller.activity startAnimating];
}
if([elementName isEqualToString:@"downloads"]){
[self.downloads_Controller.activity startAnimating];
}
}
else if([elementName isEqualToString:@"file"]){
NSLog(@"found file...");
[self.xmlArray addObject:attributeDict];
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
NSLog(elementName);
if([elementName isEqualToString:@"downloads"] || [elementName isEqualToString:@"results"]){
if([elementName isEqualToString:@"downloads"]){
NSLog(@"downloads found... reloading table");
self.downloads_Controller.downloads= xmlArray;
[self.downloads_Controller.tableView reloadData];
[self.downloads_Controller.activity stopAnimating];
}
else if([elementName isEqualToString:@"results"]){
NSLog(@"results found... reloading table");
self.results_controller.results= xmlArray;
// NSLog(@"xmlarray: %@ and results: %@", xmlArray, self.results_controller.results);
[self.results_controller.tableView reloadData];
[self.results_controller.activity stopAnimating];
}
}
else if([elementName isEqualToString:@"error"]){
UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"Error" message:@"aMule dosent seem to be on" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError{
NSLog(@"Error %i, Description: %@, Line: %i, Column: %i", [parseError code],
[[parser parserError] localizedDescription], [parser lineNumber],
[parser columnNumber]);
}
- (void)parser:(NSXMLParser *)parser validationErrorOccurred:(NSError *)validError{
NSLog(@"valid: %@", validError);
}
// END DELEGATES XML PARSER
Does someone have a clue of what it could be?
Thanks