      
      */
     func parse(_ result: @escaping (Result) -> Void) {
+        
         self.result = result
+        
         self.parse()
+        
+        if let error = parsingError {
+            self.result?(Result.failure(error))
+            return
+        }
+        
+        guard let feedType = self.feedType else {
+            self.result?(Result.failure(ParserError.feedNotFound.value))
+            return
+        }
+        
+        switch feedType {
+            
+        case .Atom:
+            self.result?(Result.atom(self.atomFeed!))
+            
+        case .RSS1, .RSS2:
+            self.result?(Result.rss(self.rssFeed!))
+            
+        }
+        
     }
     
     

    }
    
    func parser(_ parser: XMLParser, parseErrorOccurred parseError: Error) {
        self.result?(Result.failure(parseError as NSError))
    }
    
}

        
        guard let string = String(data: CDATABlock, encoding: .utf8) else {
            self.abortParsing()
            self.parsingError = ParserError.feedCDATABlockEncodingError(path: self.currentXMLDOMPath.absoluteString).value
            return
        }
        
