How to use NSXMLParser?

て烟熏妆下的殇ゞ 提交于 2020-01-03 02:56:06

问题


I have some XML which I need parsed in my Objective-C code. The XML is fairly simple. I have already searched Stackoverflow as well as Google but I did not find what I am looking for. Examples if how to use NSXMLParser would be useful, and if anyone has any suggestions on how to do this another way please let me know.


回答1:


Did you look at the Apple sample applications? From the NSXMLParser class reference, I found no fewer than five sample projects that did parsing.

  • GKTank
  • KMLViewer
  • LazyTableImages
  • SeismicXML (probably your best bet, and most directly related)
  • XMLPerformance



回答2:


I recommend going through this tutorial by Ray Wenderlich:
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml

It uses GDataXML, which from my experience is a light-weight easy to use XML parser. It goes through all the basic steps to read and write to an XML document in a specific directory, including making or ammending to the file if it doesnt exist or exists respectively.



来源:https://stackoverflow.com/questions/5507547/how-to-use-nsxmlparser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!