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

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -