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

  • SEARCH
  • Home
  • 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 6943383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:08:55+00:00 2026-05-27T13:08:55+00:00

I have searched for my prob and found the various solution on web like

  • 0

I have searched for my prob and found the various solution on web like :

Using the British pound sign in an XML feed to be read by an iPhone

NOt able to parse "&"

Special Characters in NSString from HTML

This and
here also

but it is not fruitful for me as after reading xml I am saving it in my DB.

Here is the xml :

<root>
    −<Discounts>
        <DiscountID>1</DiscountID>
        <Title>WeekEnd Offers</Title>
        <Description>Offer upto 50%</Description>
        <SalePrice>50</SalePrice>
        <RegularPrice>100</RegularPrice>
        <CreatedDate>11/14/2011</CreatedDate>
        <LastModifiedDate>11/14/2011</LastModifiedDate>
        <Status>1</Status>
        <PhotoPath>/photos/documents/coupzila/hiteshi-logo.png</PhotoPath>
    </Discounts>
</root>

m getting the description in string as :

  NSString * strDescription = [item.mdictXMLTagsData valueForKey:@"Description"];

    NSLog(@"String in description is : ",strDescription);

but the description field is getting null in console and i cant store it in my DB.

pls suggest how can I read and store special characters to my DB.

One more thing i came to know that &#37 is the keyword to read % sign but i dont know how n where to apply this.

pls help!!!

EDIT : my current code.

-(void)CallAPIForDetails
{

//RequestType = 2;
//UIApplication sharedApplication].networkActivityIndicatorVisible=YES;

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
ParsingAPI *api = [[ParsingAPI alloc]init];
api.delegate = self;


NSString *strurl = [@"" stringByAppendingFormat: @"http://192.168.1.108/Coupzila/api/default.aspx?method=GetData&RequestType=Discounts&StoreID=%d",StoreId];

NSLog(@"URL : %@",strurl);
strurl = [strurl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

api.strEntityName=@"Discounts";

api.arrayXMLTags = nil; 
api.arrayXMLAttributeTags = nil;

[api parseXMLFileAtURL:[NSURL URLWithString:strurl] showProgress:NO];   

[api release];  
[pool release];

}

- (void)feedDataArray:(ParsingAPI *)feed didFindItemsArray:(NSMutableArray *)items
{
/*
 if(RequestType == 2 )
 {*/
NSMutableArray *arraydeleteDetails = [CoreDataAPIMethods getObjectsFromContext:@"DiscountsDetail" :@"DiscountId" :YES :self.managedObjectContext];

for (float i=0;i<[arraydeleteDetails count];i++) 
{
    [self.managedObjectContext deleteObject:[arraydeleteDetails objectAtIndex:i]];
    NSError *error;
    if (![self.managedObjectContext save:&error]) {
        // Handle the error...
    }
}   

for (float i=0;i<[items count];i++) 
{               
    ParsingItem *item = [items objectAtIndex:i];

    NSMutableArray *arr = [CoreDataAPIMethods getObjectsFromContext:@"DiscountsDetail" :@"Index" :NO :self.managedObjectContext];

    if ([arr count] > 0) 
    {
        DiscountsDetail * DiscountsDetailObject = [arr objectAtIndex:0];

        NewEntryID = [DiscountsDetailObject.Index intValue] +1;

    }
    else 
    {
        NewEntryID = 1;
    }

    /*
     if (countImage == 0) 
     {
     countImage = NewEntryID;

     }*/


    //Now add the data in database 
    DiscountsDetail *data = (DiscountsDetail*)[NSEntityDescription insertNewObjectForEntityForName:@"DiscountsDetail" inManagedObjectContext:self.managedObjectContext];

    data.DiscountId = [NSNumber numberWithInt:[[item.mdictXMLTagsData valueForKey:@"DiscountID"] intValue ]];
    data.Title = [item.mdictXMLTagsData valueForKey:@"Title"];
    data.SalePrize = [item.mdictXMLTagsData valueForKey:@"SalePrice"];
    data.RegularPrize = [item.mdictXMLTagsData valueForKey:@"RegularPrice"];
    //data.Description = @"This is test descriptionsakdj bfaisdfj bgasdlkab gfdil ufghiub nrungdfg bndfiosggn iouer5nn gdfnsngdfsu gndklfngdufn gkdfjlbgn lidsfub gdilufbf gldfb ghdfsiosa ifgho aibfg iodfb dfug hbdfg iygofadqi igdfhaibg adofibg ifdbgioadfbg adfigyb asg ig agiobfg finish" ;  


  NSString * strDescription = [item.mdictXMLTagsData valueForKey:@"Description"];

    NSXMLParser * parser = [item.mdictXMLTagsData valueForKey:@"Description"];

    [self parser:parser foundCharacters:strDescription];
    NSLog(@"String in description is : ",strDescription);

    data.Description =[item.mdictXMLTagsData valueForKey:@"Description"];
    data.Index = [NSNumber numberWithInt:NewEntryID];


    NSLog(@"Description is :",data.Description);


    if ([item.mdictXMLTagsData valueForKey:@"PhotoPath"] != nil)
    {

        NSString *photopath=@"http://192.168.1.108/Coupzila/";

        NSData *dataimage=[NSData dataWithContentsOfURL:[NSURL URLWithString:[photopath stringByAppendingString:[item.mdictXMLTagsData valueForKey:@"PhotoPath"]]]];

        data.ImageDiscounts = dataimage;

    }


    NSError *error;             

    if (![self.managedObjectContext save:&error])
    {
        // Handle the error...
    }

    self.arrayDiscountDetails = [CoreDataAPIMethods getObjectsFromContext:@"DiscountsDetail" :@"DiscountId" :NO :self.managedObjectContext];

}

}

  • 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-27T13:08:55+00:00Added an answer on May 27, 2026 at 1:08 pm

    Edited :- Hope u r Initializing the currentParsedCharacter…

    This is not the exact code for u… but it should be similar… try it out or else provide code for what u r trying do that we can help in a better way.

    -(id)init{
        if(self == [super init]){
            ObjectsMutableArray = [[NSMutableArray alloc] init];
            currentParsedCharacterData = [[NSMutableString alloc]init];
        }
        return self; 
    }
    
    
    - (void)parserDidStartDocument:(NSXMLParser *)parser
    {
    
    }
    
    
    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
    {
        currentElement = elementName;
    
        if([currentElement isEqualToString:@"Table"]) {
            obj = [[SomeClass alloc]init];
        }
    
        if ( [currentElement isEqualToString:@"Description"])
        {
    
            self.currentParsedCharacterData =(NSMutableString *) @"";
        }
    
    }
    
    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
    {
        if([currentElement isEqualToString:@"OtherThanDescription"]) {
            obj.CatName=[NSString stringWithFormat:@"%@",string];
            NSLog(@"CatName to be saved in Array :- %@",string);
        }
    
        else if([currentElement isEqualToString:@"Description"]) {
    
            NSMutableString *outputBuilder =  [[NSMutableString alloc]init] ;
    
            [outputBuilder appendString:[NSString stringWithFormat:@"%@", self.currentParsedCharacterData]];
    
            [outputBuilder appendString:[NSString stringWithFormat:@"%@", string]];
    
            self.currentParsedCharacterData = outputBuilder;
    
            [outputBuilder release];
        }
    
        else 
        {
            self.currentParsedCharacterData = (NSMutableString *)string;
        }
    }
    
    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
    {
        if([elementName isEqualToString:@"Table"]) {
            NSLog(@"Current element in End Element Category:- %@",currentElement);
            [ObjectsMutableArray addObject:obj];
    
        }
        if([elementName isEqualToString:@"Description"]) {
            obj.CatDesc = self.currentParsedCharacterData;
            NSLog(@"Current element in End Element Category:- %@",obj.CatDesc);
    
        }
        currentElement = @"";
    }
    
    
    
    - (void)parserDidEndDocument:(NSXMLParser *)parser
    {
        appDelegate = (AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate];
        appDelegate.ObjectsArray = [[NSMutableArray alloc]initWithArray:ObjectsMutableArray];
    
    }
    

    // dealloc it the variables then…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched for hours now and haven't found a solution for my problem.
I have searched various online resources and found conflicting information about the possibility of
I have searched the Web for this, but with no luck. Any idea? Thanks.
I have searched far and wide on the Internet but have not found anything
I have searched on the web for software that batch convert image at different
(have searched, but not been able to find a simple solution to this one
I have searched the forums and found a few threads, but nothing specific to
I have searched and nothing that I have found hits directly on what I
I have searched and found a couple of solutions on this site, that didn't
I have searched around and found some tutorials for xsl:key and key() function, but

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.