Parsing xml with iOS swift -
i looking @ example parsing xml using swift http://ashishkakkad.com/2014/10/xml-parsing-in-swift-language-ios-8-nsxmlparser/
as can see in example, xml file located somewhere in web
var url:string="http://api.androidhive.info/pizza/?format=xml" var urltosend: nsurl = nsurl(string: url)
i want same, instead want have xml file locally part of single view project. in project should place xml file? how can access file?
thanks
just drag file anywhere in xcode project. access like
let xmlpath = nsbundle.mainbundle().pathforresource(filename, oftype: "xml") let xmldata = nsdata(contentsoffile: xmlpath)
now can parse xmldata.i use aexml purpose, can use other libraries.
Comments
Post a Comment