开发者

How would I go about parsing this .xml for iPhone table

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 Sc开发者_如何转开发ience CenterFirst.Last@millersville.edu872-3724Computer ScienceMs.FirstA.GilbertLast Science CenterFirst.Last@millersville.edu871-2214Computer ScienceDr.FirstH.LastRoddy Science CenterFirst.Last@millersville.edu872-3666


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:

  • Parsing CSV Data
  • Writing a parser using NSScanner


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜