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 6060885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:52:33+00:00 2026-05-23T08:52:33+00:00

While parsing the data I insert the data in sqlite. But for some reason

  • 0

While parsing the data I insert the data in sqlite. But for some reason when I run the SELECT query it returns me with extra line and a tab space. When I write this query it inserts the data correctly but with extra spaces.

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
   namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName 
    attributes:(NSDictionary *)attributeDict {

  if([elementName isEqual:@"root"]) {
}

else if([elementName isEqualToString:@"value"]) {
    value = [[Value alloc] init] ;
}
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { 

    if(!trueValue) 
        trueValue = [[NSMutableString alloc] initWithString:string];
    else{
        [trueValue appendString:string];

    }
    }

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName 
   namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {

if([elementName isEqualToString:@"root"])
    return;


if([elementName isEqualToString:@"value"]) {

    NSString *sqlQuery = [NSString stringWithFormat:@"INSERT OR REPLACE INTO DETAIL(ID,KEY, TITLE) VALUES ('%@','%@','%@');", key, parent_key, title];
    const char *insert_sql = [sqlQuery UTF8String];
    sqlite3_exec(db, insert_sql, NULL, NULL, NULL);
}



else if([elementName isEqualToString:@"key"])
    [value setValue:finalValue forKey:elementName]

[trueValue release];
trueValue = nil;

}

How can I REPLACE the extra spaces basically like : “\n\t\t\t” with “” before this statement for all the rows?

  • 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-23T08:52:33+00:00Added an answer on May 23, 2026 at 8:52 am

    I had a similar problem which I fixed by trimming out all the whitespace characters like this:

    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { 
    
        if(!trueValue) 
            trueValue = [[NSMutableString alloc] initWithString:[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
        else
            [trueValue appendString:[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

imagine an xml file with 5000 sets of data. While parsing , i NSLog
Hi BB developers I have a issue while parsing the xml data using DOM.
I have two arrays built while parsing a text file. The first contains the
I'm passing some numeric arguments while creating a process (in VC++) I'm stuck at
While cross-site scripting is generally regarded as negative, I've run into several situations where
I'm trying to insert into XML column (SQL SERVER 2008 R2), but the server's
I need to insert data from my parsed XML file to mySQL table. Problem
I'm sticking some data, wrapped with boost::any into a map in a class method
I'm having some troubles wrapping my head around how to go about parsing some
While the C# spec does include a pre-processor and basic directives (#define, #if, etc),

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.