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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:52:45+00:00 2026-06-08T03:52:45+00:00

I have an XML file with IDs, names and URLs stored in it I

  • 0

I have an XML file with IDs, names and URLs stored in it

I need to read the file and check the value of the ID. If it is equal to soe parameter, I will read the name and URL and stop checking. Else I advance to the next element and do the same check.

I have the following code for iPhone. It is similar to what I need to do, but I need to do it on Android:

NSString *url = @"my http url to get xml file";    
NSURL *xmlURL = [NSURL URLWithString:url];
XMLParser *parser = [[XMLParser alloc] initXMLParser];

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName 
      namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName     
{
    if([elementName isEqualToString:@"person"])
    {
        Pickers.person= person; 
        Pickers.fullName   = fullName;
        Pickers.ID = ID;
        Pickers.URl = URl;
        return;
    }

    //There is nothing to do if we encounter the Books element here.
    // and release the object.

    NSString *P_ID ;
    NSString *P_URl;

    if([elementName isEqualToString:@"ID"]) 
    {
        P_ID = currentElementValue;
        NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"\n"];

        P_ID = [[P_ID componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @""];

        P_ID =  [P_ID stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]];

        [ID addObject:P_ID];
    }    
    else if([elementName isEqualToString:@"Name"]) 
    {

        [fullName addObject:currentElementValue];
    }
    else  if([elementName isEqualToString:@"Symbol"]) 
    { 
        [person addObject:currentElementValue];
    }
}

else if([elementName isEqualToString:@"URl"]) 
{
    P_URl = currentElementValue;
    NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"\n"];

    P_URl = [[P_URl componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @""];

    P_URl =  [P_URl stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]];

    [URl addObject:P_URl];
}


}

Also I want to know which is better to use in my case: SAX parser, DOM parser or XMLPullParser?

  • 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-06-08T03:52:46+00:00Added an answer on June 8, 2026 at 3:52 am

    after a long research and trial and error i fond the most efficient and easiest (less code, less bugs) is to use Simple framework; it is amazing how easy and fun to use!

    you can find it here

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

Sidebar

Related Questions

I have a xml file which I need to open with Microsoft Word 2007.
I have an XML file that reads like this <abc> <ab>value</ab> <aa>time</aa> <ac>money</ac> </abc>
I have an XML file that I'm trying to read from here , and
I have an XML file, that contain IDs in an attribute called translatedID. This
I have an XML file with two types of elements, both have IDs. I
I have an xml file which looks like the below example <Ids> <Id> <set>ai</set>
I have xml file with such structure: ... <outer> ... <inner/> ... </outer> ...
What is the easiest way to convert xml to html? I have xml file
I have an XML file from which I am parsing some content to display
I have an XML file that looks like <?xml version=1.0> <playlist> <name>My Playlist</name> <song>

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.