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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:17:49+00:00 2026-05-18T23:17:49+00:00

I need to do xml parsing in my class. i found -(void)parser:(NSXMLParser *)parser didStartElement:(NSString

  • 0

I need to do xml parsing in my class.

i found

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

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


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

 }

But in need to do parsing two times one after another,How can i done using these methods

can any one pls help me.

Thank u in advance.

  • 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-18T23:17:50+00:00Added an answer on May 18, 2026 at 11:17 pm

    You want to do something like this?

    Have a flag variable of any type. Let us consider the flag variable is NSString. And you are going to parse two XML files. Consider, one XML is for listing items and another one is for detail view.

    Before you parse the first XML (the XML for list, in our case) you set the flag something like this,

    NSString *xmlContentFlag = @"List";
    

    Then, before you parse the second XML (the XML for detail) you set the flag something like this,

    NSString *xmlContentFlag = @"Detail";
    

    In your parser methods, do the following,

    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
        namespaceURI:(NSString *) namespaceURI qualifiedName:(NSString *)qName
        attributes: (NSDictionary *)attributeDict {
    
        if ([xmlContentFlag isEqualToString:@"List"]) {
    
            // your code here
    
        } else if ([xmlContentFlag isEqualToString:@"Detail"]) {
    
            // your code here
        }
    }
    
    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
    
        if ([xmlContentFlag isEqualToString:@"List"]) {
    
            // your code here
    
        } else if ([xmlContentFlag isEqualToString:@"Detail"]) {
    
            // your code here
        }
    }
    
    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName 
        namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
    
        if ([xmlContentFlag isEqualToString:@"List"]) {
    
            // your code here
    
        } else if ([xmlContentFlag isEqualToString:@"Detail"]) {
    
            // your code here
        }
     }
    

    Note: You can have the flag to be of any type, not necessarily NSString.

    I hope this is what you expect.

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

Sidebar

Related Questions

HI, i need a XML parser. i want to know that which one is
At work I am parsing large XML files using the DefaultHandler class. Doing that,
I'm really need help with parsing XML by TBXML. I created a demo project
I have some XML that I'm parsing with a SAX parser in Java. It
I need an XML-serializable dictionary. Actually, I now have two quite different programs that
I know how to find what I need from XML using XPath. The syntax
I have turned on warnings as errors and now i need to XML comment
I need to create XML in Perl. From what I read, XML::LibXML is great
I need to edit XML files on a small Linux box that we have
I need to consume XML based RESTful API. All request are sent in XML

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.