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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:29:18+00:00 2026-06-05T22:29:18+00:00

I have been trying to do XML parsing in iOS. But I was not

  • 0

I have been trying to do XML parsing in iOS. But I was not able to parse it unfortunately.

Can you help me with this. I was using a SAX parser using NSXML.

The data is

<category>
<cat id="info" name="id1" value="val1" />
<cat id="info" name="id2" value="val2" />
</category>

How do i get the values using SAX parser? Any help would be appreciated.

Thanks

Answer–

(To get the attributes)
I used it this way (attributedict is the NSDictionary object in didStartElement method)

NSString *attr = [attributeDict valueForKey:@"name"];
if([attr isEqualToString:@"id1"])
{
NSLog("%@", [attributeDict valueForKey:@"value"]);
}
  • 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-05T22:29:21+00:00Added an answer on June 5, 2026 at 10:29 pm

    you need to init an NSXML instance with Data then use the parse method. You need to set up a NSXMLParserDelegate protocol, then using the following methods, you’ll be able to retrieve information :

    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *) namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict;
    
    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
    
    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;
    

    You should read the apple documentation about it :

    NSXMLParser

    NSXMLParserDelegate Protocol

    You’ll find Apple examples in the links.

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

Sidebar

Related Questions

I have been trying to parse an XML file using boost's property tree, but
I have been trying to process this SOAP XML return using T-SQL but all
ok this is driving me crazy. I have been trying to parse a xml
I have been trying to parse this xml in c# <schema uri=http://blah.com/schema > <itemGroups>
I have been trying to create an XML using the simplexml library (v2.6.2) http://simple.sourceforge.net/home.php
I have been trying to create a ListView which I can sort using drag
I have been trying to output XML with PHP but encountered a strange(!) error
I have been trying to parse a file with xml.etree.ElementTree : import xml.etree.ElementTree as
I have been trying to validate XML file using schema file in my C
Have been trying to encrypt an xml file to a string so that I

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.