Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:11:29+00:00 2026-05-26T05:11:29+00:00

this is my parser section where i am getting the attribute and values from

  • 0

this is my parser section where i am getting the attribute and values from the xml file.now when it will parse the xml concurrently should show the attribute and its value in the table view cell one bye one.

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ 
//NSLog(@"found this element: %@", elementName); 
currentElement = [elementName copy]; 
if([elementName isEqualToString:@"ProductData"])
    {
    objectsArray = [[NSMutableArray alloc] init];
    productDict = [[NSMutableDictionary alloc] init];
   }

} 
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ 
//NSLog(@"found characters: %@ %@", currentElement,string);
if(!currentString){
    currentString = [[NSMutableString alloc] init];
}
[currentString appendString:string]; 
} 
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:   (NSString *)namespaceURI qualifiedName:(NSString *)qName{ 
//NSLog(@"ended element: %@", elementName); 
if([elementName isEqualToString:@"id"])
{
    [productDict setObject:currentString forKey:@"id"];
    [self labelsetting:0];
    [currentString release],currentString = nil;

    return;
}
if([elementName isEqualToString:@"productNumber"])
{
    [productDict setObject:currentString forKey:@"productNumber"];
    [self labelsetting:0];
    [currentString release],currentString = nil;
    return;
}
if([elementName isEqualToString:@"name"])
{
    [productDict setObject:currentString forKey:@"name"];
    [self labelsetting:0];
    [currentString release],currentString = nil;
    return;
}
if([elementName isEqualToString:@"dateCreated"])
{
    [productDict setObject:currentString forKey:@"dateCreated"];
    [self labelsetting:0];
    [currentString release],currentString = nil;
    return;
}
if([elementName isEqualToString:@"image"])
{
    [productDict setObject:currentString forKey:@"image"];
    [self labelsetting:0];
    [currentString release],currentString = nil;
    return;
}
if([elementName isEqualToString:@"ProductData"])
{
    [objectsArray addObject:productDict];

    [productDict release],productDict = nil;
}
[currentString release], currentString = nil;


} 

below my tableview where i want to show the xml data.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section    { 
return [objectsArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
    //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
    cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:15.0];


}


productDict = [objectsArray objectAtIndex:indexPath.row];

NSString *data = nil;
for (NSString *key in [productDict allKeys] ) {
   // [data stringByAppendingFormat:@"%@ %@",key,[productDict objectForKey:key]];
    data = [NSString stringWithFormat:@"%@%@", key,[productDict objectForKey:key]];

    NSLog(@"data: %@",data);

}
cell.textLabel.text = data;

return cell;
[data release];
}

This the console of this view controller

2011-10-16 15:19:01.627 cmsCommander[1795:207] namestring: emon
2011-10-16 15:19:01.630 cmsCommander[1795:207] username: emon@test.com
2011-10-16 15:19:01.874 cmsCommander[1795:207] found file and started parsing
2011-10-16 15:19:01.877 cmsCommander[1795:207] current Element id : 1
2011-10-16 15:19:01.879 cmsCommander[1795:207] current Element productNumber :    a91cc0f4c7
2011-10-16 15:19:01.880 cmsCommander[1795:207] current Element name : Product 1
2011-10-16 15:19:01.881 cmsCommander[1795:207] current Element image :  5e928bbae358c93caedf6115fa7d178b.jpg
2011-10-16 15:19:01.882 cmsCommander[1795:207] current Element dateCreated : 2011-10-06T16:08:45
2011-10-16 15:19:01.883 cmsCommander[1795:207] current Element id : 2
2011-10-16 15:19:01.888 cmsCommander[1795:207] current Element productNumber : d8287e2e51
2011-10-16 15:19:01.892 cmsCommander[1795:207] current Element name : Product 2
2011-10-16 15:19:01.893 cmsCommander[1795:207] current Element image : 8bbd8dfff3cdd28285d07810a4fe7c32.jpg
2011-10-16 15:19:01.895 cmsCommander[1795:207] current Element dateCreated : 2011-10-06T16:08:45
2011-10-16 15:19:01.896 cmsCommander[1795:207] current Element id : 3
2011-10-16 15:19:01.897 cmsCommander[1795:207] current Element productNumber : 7931c08c22
2011-10-16 15:19:01.897 cmsCommander[1795:207] current Element name : Product 3
2011-10-16 15:19:01.902 cmsCommander[1795:207] current Element image : e19becad20d6f4378e37313c5dbdf070.jpg
2011-10-16 15:19:01.904 cmsCommander[1795:207] current Element dateCreated : 2011-10-06T16:08:45
2011-10-16 15:19:01.904 cmsCommander[1795:207] all done!
2011-10-16 15:19:01.906 cmsCommander[1795:207] The number of row in the object array:  1 
2011-10-16 15:19:01.909 cmsCommander[1795:207] data: name  Product 3
2011-10-16 15:19:01.910 cmsCommander[1795:207] data: id  3
2011-10-16 15:19:01.911 cmsCommander[1795:207] data: productNumber  7931c08c22
2011-10-16 15:19:01.912 cmsCommander[1795:207] data: image  e19becad20d6f4378e37313c5dbdf070.jpg
2011-10-16 15:19:01.913 cmsCommander[1795:207] data: **dateCreated  2011-10-06T16:08:45**

now i think you have got my question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:11:30+00:00Added an answer on May 26, 2026 at 5:11 am
        - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
                return 1;
        }
        - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {  
                return [objectsArray count];
        }
    
        - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {    
    
                static NSString *CellIdentifier = @"Cell";
    
                UITableViewCell *currentCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
                if (currentCell == nil) {
                    currentCell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
                }
                NSMutableDictionary *productDict = [objectsArray objectAtIndex:indexPath.row];
    NSString *data = nil;
        for (NSString *key in [productDict allKeys] ) {
            [data stringByAppendingFormat:@"%@",key,[dic objectForKey:key]];
        }
                currentCell.textLabel.text = data;
    
                return currentCell;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have student.xml file and am parsing this file using SAX Parser and now
I am doing this faq section by getting content from json files, which I
This is a noob question from someone who hasn't written a parser/lexer ever before.
i am developing parser using bison...in my grammar i am getting this error Here
i need to parse this php xml response in android: <?phpxml version=1.0 encoding=utf-8?> <SmsResponse>
I'm try to parse this xml, but c# keeps throwing an exception saying it
I have this spec: it 'can parse armies with only section headers' do list
I am getting some response from server side which i need to parse but
I'm writing out some xml from C# using the .net framework's XmlTextWriter. This works
I'm trying to parse an html output file from a program called mirdeep. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.