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

The Archive Base Latest Questions

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

I need to parse an HTML document using NSXmlParser.As you know there are three

  • 0

I need to parse an HTML document using NSXmlParser.As you know there are three main delegate methods parser:didStartElement….,parser:DidEndElement:….. and parser:foundCharacters: methods. I really can’t understand how the last method is useful? What does it provide that parser:didStartElement:.. method does not.Let’s say I have the following piece of an HTML document:

<img src="http://eurovision.az/attachments/news/main_images/
 b_a71309d9c34df72adbbb29d506bc5034.jpg" alt=""
rel="http://eurovision.az/attachments/news/main_images/
t_a71309d9c34df72adbbb29d506bc5034.jpg" title="#htmlcaption1" />

Now, to parse this part of the HTML at which point would I use which of these three methods? Thanks ahead.

  • 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-31T03:29:22+00:00Added an answer on May 31, 2026 at 3:29 am

    In the exmaple HTML that you’ve given the parser:foundCharacters method isn’t very useful. This is because it reads the characters in the value part of an XML/XHTML element.

    So, given the following XML:

    <person><firstname>bon</firstname><secondname>joydell</secondname></person>
    

    And the following almost-code:

    NSMutableString *everythingString = [NSMutableString string];
    
    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
    
        [everythingString appendString:string];
    }
    

    Then everythingString would contain “bonjoydell”. parser:didStartElement would be called on finding the <person>, <firstname> and <secondname> tags. parser:didEndElement would be called on finding the </firstname>, </secondname> and </person> tags.

    parser:didStartElement doesn’t give you access to the values contained in the XML elements but it does give you access to the attribute values.

    So, back to your example, the only delegate methods that would be usefully called are parser:didStartElement and parser:didEndElement and being as the tag in your example is self contained and has no child elements only parser:didStartElement would yield any useful data.

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

Sidebar

Related Questions

I am using python + BeautifulSoup to parse an HTML document. Now I need
I need to browse the DOM tree of a parsed HTML document. I'm using
I need to parse a html document that has been generated by saving a
I am currently using JTidy to parse an HTML document and fetch a collection
In need in my application to fetch remote HTML document and parse some parts
I have a collection of HTML documents for which I need to parse the
I need to parse html for a project and looking for a good html
i need to find away to parse html and css layout to be able
Ok guys.. I have a HTML i need to parse into a php script
I am trying to parse the following HTML. I need to get the innertext

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.