PDA

View Full Version : Parsing Text file




iphonejudy
Dec 8, 2008, 06:33 AM
Hi,

I want to parse a text file.

I used the below code for parsing .xml file.


http://theappleblog.com/2008/08/04/tutorial-build-a-simple-rss-reader-for-iphone/

In this code i cannot parse .txt file.

Can anybody please give me the code?

Regards
judy



jnic
Dec 8, 2008, 10:45 AM
You're going to tell us what format the file you're trying to parse is in.

iphonejudy
Dec 9, 2008, 10:52 PM
:DYou're going to tell us what format the file you're trying to parse is in.



I want to display a .txt file from the http connection.

Like http://myweb.com/file.txt.


judy

xsmasher
Dec 10, 2008, 11:31 AM
You want [NSData dataWithContentsOfURL:myURL]; Then you can get the [NSData bytes] , and move through the bytes as though they were an array of chars.

Or you could do [NSString stringWithContentsOfURL:encoding:error:] and use string methods to split it up further.