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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:26:12+00:00 2026-05-23T07:26:12+00:00

I’m parsing this document: http://greenmoss.dk/recipe01.xml and going through each element and saving the data.

  • 0

I’m parsing this document: http://greenmoss.dk/recipe01.xml and going through each element and saving the data. But I’m unable to find this element:

ingList id=”1″

I’ve tried this:

        //--------ING-List--------

else if ([elementName isEqualToString:@"ingList id=\"1\""])
{
    NSLog(@"ING-LIST HERE!!!!", nil);
}

and tried this:

//--------ING-List--------

else if ([elementName isEqualToString:@"ingList"])
{
    NSLog(@"INGLIST HERE!!!!", nil);
}

How do I locate that element?

  • 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-23T07:26:13+00:00Added an answer on May 23, 2026 at 7:26 am

    It makes sense that the first would fail and the second would succeed. In:

    <ingList id="1"> ... </ingList>
    

    The element name is “ingList”. This element also has one attribute; this attribute’s name is “id” and its value is “1”.

    Because the element name is just “ingList”, [elementName isEqualToString:@"ingList"] will succeed, but [elementName isEqualToString:@"ingList id=\"1\"] will fail because id=”1″ is not part of the element name.

    In order to get this to work, you’ll have to first check if the element name is “ingList” (which you can already do). If it is, you’ll have to get the attributes from that element, determine if one of them has the name “id”, and if that attribute’s value is “1”.

    else if ([elementName isEqualToString:@"ingList"])
    {
        // Find attribute "id"
        // Determine if value of "id" is "1"
        if (...) {
            // Do what you need to do.
        }
    }
    

    Unfortunately, I don’t know what language you are using or what XML library is being used, so I can’t fill in the details of determining attribute values.

    Edit: Looking around, it looks like your inner test could be something along the lines of the following, but like I said, I don’t have experience with this so the code could be wrong.

    else if ([elementName isEqualToString:@"ingList"])
    {
        // Find value of attribute "id"
        NSString *id = [NSString stringWithFormat:@"%@", [attributeDict objectForKey:@"id"]];        
        // Determine if value of "id" is "1"
        if ([id isEqualToString:@"1"]) {
            // Do what you need to do.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to construct a data frame in an Rcpp function, but when I
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.