Stripping markup from a string.

Discussion in 'iOS Programming' started by Delta-NC, Feb 3, 2009.

  1. Delta-NC macrumors member

    Delta-NC

    Joined:
    Apr 22, 2008
    Location:
    Scotland, European Union
    #1
    Sorry if this is answered elsewhere but I feel I may be googling the wrong terms.

    Is there an easy way to strip markup tags from a string? I'm reading some RSS data and the description fields have tags in them. I started by trying "stringByReplacingOccurrencesOfString" but it quickly became apparent that not only was this code heavy but also wasn't going to work in every situation.

    Is there a better way to go about this? rendering the string and capturing the output perhaps?
     
  2. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
    Markup as in <tag></tag> or HTML entities? You can remove the former using NSXMLParser.
     
  3. Delta-NC thread starter macrumors member

    Delta-NC

    Joined:
    Apr 22, 2008
    Location:
    Scotland, European Union
    #3
    The tags, and any properties of them. The visible text is fine.
     

Share This Page