Search code examples
objective-cxmlparsingxml-parsinggdataxml

Error with GDataXMLDocument parsing


I want to access this xml page:

http://www.priorbank.by/CurratesExportXml.axd

I write:

NSArray *exchangeRateTableStringNodes = [document nodesForXPath:@"//LIST_R_DATE/R_DATE/LIST_E_CHANNEL/E_CHANNEL/LIST_RATE/RATE" error:nil];

But I get 115 wrong array items instead of three correct. Where is the mistake?


Solution

  • The only solution I have found is a splitting of this string into strings:

    NSArray *exchangeRateTableStringNodes = [document nodesForXPath:@"//LIST_R_DATE/R_DATE/LIST_E_CHANNEL/E_CHANNEL/" error:nil];
    NSMutableArray *exchangeRateTableStrings = [[NSMutableArray alloc] init];
    NSArray *tempArr = [exchangeRateTableNode elementsForName:@"LIST_RATE"];
    GDataXMLElement *tempElement = [tempArr objectAtIndex:0];
    NSArray *exchangeRateTableStringNodes = [tempElement elementsForName:@"RATE"];
    

    But I still don't know why does it happen