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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:40:31+00:00 2026-06-05T01:40:31+00:00

I have a complex long XHTML file, which contains CSS. Searching on google and

  • 0

I have a complex long XHTML file, which contains CSS. Searching on google and on this site, I’ve found some libraries that can be useful on XHTML parsing:

  • NSXMLParser
  • TBXML
  • And some others

However, I’m wondering if there is any library for iPhone that can convert a xhtml + css document to a NSAttributedString (only the text, of course).

I have been thinking on that problem, and I have had some ideas, but I think it won’t be very efficient. My main idea is formed by this steps:

  • Detect on the XTHML file all tags with an id or class attribute and get the range of the string where they have effect (I cannot achieve this).
  • Save all the CSS attributes on a NSDictionary, with more NSDictionary objects inside. Something like this:

    mainDict {
        object: dictionary {
             object: @"#00ff00"
             key: @"color"
             object: @"1em"
             key: @"font-size"
        }
        key: @"a id"
        object: anotherDictionary {
            ...
        }
        key: @"another id"
    }
    
  • Convert these CSS attributes dictionary on the NSAttributedStringattributes dictionary.

I know that this is complex, and I don’t need you to provide the code (of course, if you provide it, it would be great), I only want the link to a library or, if it doesn’t exist, some advice for create a parser myself.

Of course, if you need some more information, ask by comments.

Thanks you!!

  • 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-05T01:40:32+00:00Added an answer on June 5, 2026 at 1:40 am

    It depends on your needs if this will do what you want, but DTCoreText has an HTML -> NSAttributedString converter. It’s very specific for what DTCoreText wants to / needs to do, but it might at least point you in the right direction.

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

Sidebar

Related Questions

I have a complex regex, which contains constructs like this one: ( + sectionPattern
I have some complex regular expressions which I need to comment for readability and
I have a complex action which can take a long time to run. If
To make a long story short, I have some mildly complex queries (see example
I have this long and complex source code that uses a RNG with a
(its a long story) but I have a large complex project file containing a
I am using WCF and REST, and I have complex types, which are working
I have a complex type defined which doesn't currently contain any minOccurs restrictions. When
I have a complex map, which doesn't need locking for the frequent gets and
In linux, Is there a way I can save my long/complex passwords I have

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.