Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: iPhone
I need to call a XML file from a WCF Service and Parse the content of XML in iPhone.
I m able to call the service url but when doing parsing using NSXMLParser I couldn't get a patricular attribute value in XML .I m using a ViewController application in XCode.
My XML file is like this :
<GetCompanyResponse xmlns="" xmlns:i="
I have tried this code :
NSString *urlString = [NSString stringWithFormat:@"
NSURL *jsonUrl =[NSURL URLWithString:urlString];
 NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:jsonUrl];
    [parser setDelegate:self];
    [parser setShouldProcessNamespaces:NO];
    [parser setShouldReportNamespacePrefixes:NO];
    [parser setShouldResolveExternalEntities:NO];
    [parser parse];
    [parser release];  
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
  namespaceURI:(NSString *)namespaceURI qualifiedName:
(NSString *)qName attributes:(NSDictionary *)attributeDict
    if ([elementName isEqualToString:@"Company"]) {
        NSString *name=[attributeDict objectForKey:@"Id"];
But when I check for the value in 'name' it is returning nil.Couldn't get where I m I going wrong?What should I change?How can I get the value in ID attribute?
Any help would be appreciated..
Thanks in advance..
Posted 24-Sep-12 21:01pm
Edited 24-Sep-12 21:06pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 746
1 OriginalGriff 345
2 Magic Wonder 131
3 Kishore Pogaru 130
4 Fredrik Bornander 130
0 OriginalGriff 5,705
1 Sergey Alexandrovich Kryukov 4,763
2 CPallini 4,570
3 George Jonsson 3,142
4 Gihan Liyanage 2,450

Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100