0

I am making a directory for an app and I need to parse the the names, e-mail, phone #, and office for each item that I want to display in a UITableView. I have a class made but I have never really dealt with pasring anything past simple txt files.

I need to load a URL to a xml file, which consists of the following type of data at the bottom. It does not have xml tags, but it is saved as a .xml

I have read up on the NSXMLParsers, but I wasn't sure if that would be the correct way to do this or if there was an easier way.

Example of part of the .xml file below, this is just part of a few hundred lines that are organized in the same manner, by division, department, then person.

Thanks for any help!

http://cs.millersville.edu/School of Science and MathematicsDr.FirstH.LastRoddy Science CenterFirst.Last@millersville.edu872-3838Computer ScienceMrs.First.LastRoddy Science CenterFirst.Last@millersville.edu872-3858Computer ScienceDr.FirstH.LastRoddy Science CenterFirstH.LastRoddy@millersville.edu872-3470Computer ScienceDr.FirstH.LastRoddy Science CenterFirst.Last@millersville.edu872-3724Computer ScienceMs.FirstA.GilbertLast Science CenterFirst.Last@millersville.edu871-2214Computer ScienceDr.FirstH.LastRoddy Science CenterFirst.Last@millersville.edu872-3666

Community
  • 1
  • 1
RyanG
  • 4,393
  • 2
  • 39
  • 64
  • http://stackoverflow.com/questions/406811/iphone-development-xmlparser-vs-libxml2-vs-touchxml Check out the XML dev libraries referenced here; may be easier options. – Chris Zelenak Feb 08 '11 at 05:39
  • I have read all of that, but any of those XML parsers I looked at deal with nodes and tags, which my xml file does not contain. – RyanG Feb 08 '11 at 05:59

2 Answers2

0

without the xml tags, your file is as good as a plain text file... rows separated by new line character.... and each line contains data separated by a dot (.) or something like that. figure out the pattern and parse it like you would parse a text file...

Swapnil Luktuke
  • 10,385
  • 2
  • 35
  • 58
0

There's no way you can use a xml parser for this file.

Instead you may try to use NSScanner to parse the text file. A couple of tutorials are listed here:

Elias
  • 504
  • 3
  • 9
  • Thanks! I am going to try these tutorials out and i'll post if I run into any issues. – RyanG Feb 08 '11 at 15:21
  • I tried looking at the XML in another browser, and now the tags show up.. ended up using the TBXML parser and all is good:) – RyanG Feb 11 '11 at 05:42