SWXMLHash

码农软件 · 软件分类 · XML相关工具 · 2019-09-17 18:44:31

软件介绍

SWXMLHash 是相对简单的使用 Swift 解析 XML 的方式,如果想拥有类似 NSXMLParser 的功能,SWXMLHash 会提供一个简单的封装,同时提供一个 XML 转换成数组目录的方式(比如 hash)。

API 灵感来源于 SwiftyJSON

示例:

// instantiate your SWXMLHash instance
let parser = SWXMLHash()

// begin parsing
let xml = parser.parse(xmlToParse)

// will return "Test Title Header"
xml["root"]["header"]["title"].element?.text

// will return "Ralls, Kim"
xml["root"]["catalog"]["book"][1]["author"].element?.text

// will return "bk102"
xml["root"]["catalog"]["book"][1].element?.attributes["id"]

// will return "Computer, Fantasy, Fantasy
"", ".join(xml["root"]["catalog"]["book"].all.map { elem in elem["genre"].element!.text! })

// error handling

switch 
xml["root"]["what"]["header"]["foo"] {
case .Element(let elem):
    // everything is good, code away!
case .Error(let error):
    // error is an NSError instance that you can deal with}


本文地址:https://www.codercto.com/soft/d/14815.html

Pattern Recognition and Machine Learning

Pattern Recognition and Machine Learning

Christopher Bishop / Springer / 2007-10-1 / USD 94.95

The dramatic growth in practical applications for machine learning over the last ten years has been accompanied by many important developments in the underlying algorithms and techniques. For example,......一起来看看 《Pattern Recognition and Machine Learning》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换