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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:19:31+00:00 2026-05-29T11:19:31+00:00

Parsing works great. -(void) callParse { parser = [[NSXMLParser alloc] initWithData:data]; parser.delegate = self;

  • 0

Parsing works great.

-(void) callParse
{
 parser = [[NSXMLParser alloc] initWithData:data];
 parser.delegate = self;
 [parser parse];
 [parser release];
}

I want to perform parsing in background. This code doesn’t do any parsing. But why?

 @interface NSXMLParser(Private)
- (void)myParse;
@end

@implementation NSXMLParser(Private)
- (void)myParse
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  [self parse];
  [pool drain];
}
@end

-(void) callParse2
{
 parser = [[NSXMLParser alloc] initWithData:data];
 parser.delegate = self;
 [NSThread detachNewThreadSelector:@selector(myParse) toTarget:parser withObject:nil];
 [parser release];
 }

UPDATE: I call callParse2 4 times and it creates 4 threads. It does some parsing but the results is messy. May be I have some problem with synchronization variables. NSXMLParser calls delegates which uses nonatomic properties.

  • 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-29T11:19:32+00:00Added an answer on May 29, 2026 at 11:19 am

    I’m not entirely sure why it wouldn’t work in a category method but have you tried activating the thread on the object your are calling the NSXMLParser from?

    - (void)startParsing{
    //...
    
      [NSThread detachNewThreadSelector:@selector(parseXML:) 
                       toTarget:self withObject:parseData];
    
    //..
    }
    
    - (void)parseXML:(id)parseData
    {
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      NSXMLParser * parser = [[NSXMLParser alloc] initWithData:parseData];
      parser.delegate = self;
      [parser parse];
      [parser release];
      [pool drain];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am parsing xml file data from an url. All works great when device
Usually JAXB works but it is not parsing my schema correctly or something as
I've got a game in VB6 and it works great and all, but I
I've got a Flex 3 project that uses xml. It works great in Safari
I am uploading a csv file and then parsing it using str_getcsv. All works
I'm new to the NSXMLParser, so I decided to take this tutorial: http://www.xcode-tutorials.com/parsing-xml-files/ and
I am trying to use jQuery to parse an in-memory XML document. This works
When I deploy the sample ajaxanywhere application on weblogic 8.x it works great. When
I got a problem regarding parsing XML data. I have divided my program into
I wrote a little wrapper using beautifulsoup great html parser recently I tried to

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.