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

The Archive Base Latest Questions

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

So I have some HTML text that I would like to display in a

  • 0

So I have some HTML text that I would like to display in a tableView.

I have two UITableView cells. A quote cell and a ‘non-quote’ cell.

I need to be able to break this HTML up into an array where the quotes are displayed properly

In other words The following html:

<div class='comment'>
     This is some text before the quote
     <div class='quote'>
         This is some text in a quote
     </div>
     This is between the quotes
     <div class='quote'>
             This is text in another quote
         <div class='unrelatedDiv'>
             this is in an unrelated div
         </div>
     </div>
      This is some text after the quote
</div> 

Would look something like this in an array when finished.
This would then be loaded into my tableView which would know there are 5 sections and that 1 and 3 are suppose to be quotes.

[0] => "This is some text before the quote"
[1] => "This is some text in a quote"
[2] => "This is between the quotes"
[3] => "This is text in another quote \n this is in an unrelated div"
[4] => "This is some text after the quote"
  • 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-31T12:41:21+00:00Added an answer on May 31, 2026 at 12:41 pm

    I would use DTHTMLParser from the DTCoreText project for this. It is an Objective-C wrapper around libxml2.

    For your example HTML, you would see delegate calls such as these, in the order of their appearance:

    2012-03-13 didStartElement: div attributes: { class = comment; }

    2012-03-13 foundCharacters: This is some text before the quote

    2012-03-13 didStartElement: div attributes: { class = quote; }

    2012-03-13 foundCharacters: This is some text in a quote

    2012-03-13 didEndElement: div

    2012-03-13 foundCharacters: This is between the quotes

    2012-03-13 didStartElement: div attributes: { class = quote; }

    2012-03-13 foundCharacters: This is text in another quote

    2012-03-13 didStartElement: div attributes: { class = unrelatedDiv; }

    2012-03-13 foundCharacters: this is in an unrelated div

    2012-03-13 didEndElement: div

    2012-03-13 foundCharacters:

    2012-03-13 didEndElement: div

    2012-03-13 foundCharacters: This is some text after the quote

    2012-03-13 didEndElement: div

    So you can basically just use the [DTHTMLParser parser:foundCharacters:] delegate method.

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

Sidebar

Related Questions

I have a JLabel that needs to display some html-formatted text. However, I want
I have some text that has HTML hyper-links in it. I want to remove
I have some html files that I want to convert to text. I have
I have HTML + CSS text. I need some lib with simple function like
I have a simple HTML Form that allows the user to enter some text
I have some html content stored in a database field. I would like trusted
I have some html which I would like to manipulate. Its structure is as
I have a Collection of items that I would like to display the Total
I am dealing with some HTML text that I basically have read access to.
I have an XML file containing some scientific text that I want to display

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.