Skip to content

Instantly share code, notes, and snippets.

@fitomad

fitomad/swiftxml_sections.swift Secret

Last active Mar 26, 2020
Embed
What would you like to do?
...
public func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String] = [:])
{
switch elementName
{
case AuthorsSection:
let authorParser = AuthorParser() // 1
authorParser.delegate = self // 2
// el control pasa a sus manos
self.parser.delegate = authorParser // 3
// Para no perder la referencia
self.actualParser = authorParser // 4
case BuyLinksSection:
let linksParser = LinksParser()
linksParser.delegate = self
// el control pasa a sus manos
self.parser.delegate = linksParser
// Para no perder la referencia
self.actualParser = linksParser
...
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment