in OSSSwiftDemo/OSSSwiftDemoTests/OSSXMLDictionaryTests.swift [25:48]
func testForXMLDictionary() {
let filePath = Bundle.main.path(forResource: "test", ofType: "xml")
var dict = NSDictionary.oss_dictionary(withXMLFile: filePath)
XCTAssertNotNil(dict)
if dict != nil {
let strings = (dict as! NSDictionary).oss_arrayValue(forKeyPath: "string-array")
let titleString = (dict as! NSDictionary).oss_stringValue(forKeyPath: "title")
let noteDict = (dict as! NSDictionary).oss_dictionaryValue(forKeyPath: "note")
XCTAssertNotNil(strings)
XCTAssertNotNil(titleString)
XCTAssertNotNil(noteDict)
}
let data = NSData.init(contentsOfFile: filePath!)
let parser = XMLParser.init(data: data! as Data)
XCTAssertNotNil(parser)
let ossXMLParser = OSSXMLDictionaryParser.sharedInstance()
ossXMLParser?.preserveComments = true
dict = ossXMLParser?.dictionary(with: parser)
XCTAssertNotNil(dict)
}