• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: extracting html from text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extracting html from text file


  • Subject: Re: extracting html from text file
  • From: Pierre-Olivier Latour <email@hidden>
  • Date: Wed, 03 Jul 2002 17:34:51 +0200

> I am just learning cocoa, and have an idea for a project. I have a plain
> text file, and part of the text is HTML code. the html part ofcourse starts
> with <html> and ends with </html>, so I have two markers. What I want to do
> is read the text file, scan each line until <html> is found, store the text
> that follows in a separate object until </html> and then save the html
> text. Sound simple, but at this point I have no idea what would be the best
> way to approach this. Can I eg read the text in an NSString, and then scan
> the text with regular expressions (like in perl). Or does Cocoa alread have
> clesses that do such things?

You should be able to strip out HTML tags from a text by using the
NSAttributedString class with the initWithHTML method, then use standard
NSString methods to extract C text without any HTML tags (e.g. cstring
method).

I remember trying this a while ago, and it worked.

Look in AppKit.pdf and Foundation.pdf for more info


_____________________________________________________________

Pierre-Olivier Latour email@hidden
Manager and Lead Programmer
French Touch software http://www.french-touch.net

Cool source code: http://www.french-touch.net/CodeWareHouse
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: extracting html from text file
      • From: Koen van der Drift <email@hidden>
References: 
 >extracting html from text file (From: Koen van der Drift <email@hidden>)

  • Prev by Date: extracting html from text file
  • Next by Date: RE: Cocoa stripping resource forks: does Jaguar fix?
  • Previous by thread: extracting html from text file
  • Next by thread: Re: extracting html from text file
  • Index(es):
    • Date
    • Thread