Use StringDictionary typealias. Delete unused ParserTests.swift.
This commit is contained in:
parent
1f8b296a9c
commit
5eb2c524e6
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import FoundationExtras
|
||||||
import SAX
|
import SAX
|
||||||
import DateParser
|
import DateParser
|
||||||
|
|
||||||
@ -27,8 +28,8 @@ final class AtomParser {
|
|||||||
articles.last
|
articles.last
|
||||||
}
|
}
|
||||||
|
|
||||||
private var attributesStack = [SAXParser.XMLAttributesDictionary]()
|
private var attributesStack = [StringDictionary]()
|
||||||
private var currentAttributes: SAXParser.XMLAttributesDictionary? {
|
private var currentAttributes: StringDictionary? {
|
||||||
attributesStack.last
|
attributesStack.last
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +242,7 @@ private extension AtomParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func enclosure(_ urlString: String, _ attributes: SAXParser.XMLAttributesDictionary) -> RSSEnclosure? {
|
func enclosure(_ urlString: String, _ attributes: StringDictionary) -> RSSEnclosure? {
|
||||||
|
|
||||||
let enclosure = RSSEnclosure(url: urlString)
|
let enclosure = RSSEnclosure(url: urlString)
|
||||||
enclosure.title = attributes[XMLString.title]
|
enclosure.title = attributes[XMLString.title]
|
||||||
@ -293,7 +294,7 @@ extension AtomParser: SAXParserDelegate {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let xmlAttributes = saxParser.attributesDictionary(attributes, attributeCount: attributeCount) ?? SAXParser.XMLAttributesDictionary()
|
let xmlAttributes = saxParser.attributesDictionary(attributes, attributeCount: attributeCount) ?? StringDictionary()
|
||||||
attributesStack.append(xmlAttributes)
|
attributesStack.append(xmlAttributes)
|
||||||
|
|
||||||
if parsingXHTML {
|
if parsingXHTML {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import FoundationExtras
|
||||||
import SAX
|
import SAX
|
||||||
import DateParser
|
import DateParser
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ public final class RSSParser {
|
|||||||
private var parsingArticle = false
|
private var parsingArticle = false
|
||||||
private var parsingChannelImage = false
|
private var parsingChannelImage = false
|
||||||
private var parsingAuthor = false
|
private var parsingAuthor = false
|
||||||
private var currentAttributes: SAXParser.XMLAttributesDictionary?
|
private var currentAttributes: StringDictionary?
|
||||||
|
|
||||||
static func parsedFeed(with parserData: ParserData) -> RSSFeed {
|
static func parsedFeed(with parserData: ParserData) -> RSSFeed {
|
||||||
|
|
||||||
@ -265,7 +266,7 @@ private extension RSSParser {
|
|||||||
static let type = "type"
|
static let type = "type"
|
||||||
}
|
}
|
||||||
|
|
||||||
func addEnclosure(_ attributes: SAXParser.XMLAttributesDictionary, _ currentArticle: RSSArticle) {
|
func addEnclosure(_ attributes: StringDictionary, _ currentArticle: RSSArticle) {
|
||||||
|
|
||||||
guard let url = attributes[EnclosureKey.url], !url.isEmpty else {
|
guard let url = attributes[EnclosureKey.url], !url.isEmpty else {
|
||||||
return
|
return
|
||||||
@ -304,7 +305,7 @@ extension RSSParser: SAXParserDelegate {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var xmlAttributes: SAXParser.XMLAttributesDictionary? = nil
|
var xmlAttributes: StringDictionary? = nil
|
||||||
if (isRDF && SAXEqualTags(localName, XMLName.item)) || SAXEqualTags(localName, XMLName.guid) || SAXEqualTags(localName, XMLName.enclosure) {
|
if (isRDF && SAXEqualTags(localName, XMLName.item)) || SAXEqualTags(localName, XMLName.guid) || SAXEqualTags(localName, XMLName.enclosure) {
|
||||||
xmlAttributes = saxParser.attributesDictionary(attributes, attributeCount: attributeCount)
|
xmlAttributes = saxParser.attributesDictionary(attributes, attributeCount: attributeCount)
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
import XCTest
|
|
||||||
import FeedParser
|
|
||||||
|
|
||||||
final class ParserTests: XCTestCase {
|
|
||||||
func testExample() throws {
|
|
||||||
// XCTest Documentation
|
|
||||||
// https://developer.apple.com/documentation/xctest
|
|
||||||
|
|
||||||
// Defining Test Cases and Test Methods
|
|
||||||
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user