NSXMLParser在Swift中一個封裝:VMXMLParser

jopen 10年前發布 | 19K 次閱讀 Apple Swift開發 VMXMLParser

NSXMLParser在Swift中一個封裝:VMXMLParser。

特性:

1) Closure based

2) Response as array of dictionaries

3) Unicode support

Screenshot

dddd.png

Sample code

var url:String="http://www.varshylmobile.com/projects-1/iOS/sample1.xml"
    VMXMLParser.initParserWithURLString(url, completionHandler: {
        (tags, error) -> Void in
        if(error != nil){
            println(error)
        }else{
            println(tags!)
        }
        })

Sample response

( { description = "Does this parser work ?"; id = 1; location = India; name = "Jimmy Jose the swifter"; }, { description = "Running out of words now"; id = 2; location = USA; name = "Jimmy Jose the objector"; }, { description = "Jimmy Jose Varshyl Mobile"; id = 3; location = USA; name = "Varshyl Mobile"; }, { description = "Need to have better example next time"; id = 4; location = Delhi; name = Varshyl; }, { description = "I should have downloaded some sample xml file"; id = 5; location = Australia; name = "Varshyl Mobile XML Parser"; } )

項目主頁:http://www.baiduhome.net/lib/view/home/1418097209323

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!