views:

52

answers:

1

Hi, I want to read XHTML tags and text separately using objective C.

what approach I have to follow?

+2  A: 

Use an XML parser like NSXMLParser.

Ole Begemann
thanks Ole,Parsing is bit slow, is it not possible by using NSFileHandle or any other approach.
ashish
@ashish: reading the XHTML tags from a file is the definition of parsing. There's no other way to separate them than to parse the file to discover which elements are tags and which are text. You do _not_ want to try implementing this yourself because `NSXMLParser` is much better at handling poorly formed HTML than you are.
Alex
this code snippet is also nice.http://rudis.net/content/2009/01/21/flatten-html-content-ie-strip-tags-cocoaobjective-c
ashish