      - returns: A populated GameRank structure
      */
     public static func deserialize(element: XMLElement) throws -> GameRank {
-        guard let typeStr = element.attributes["type"],
-            let idStr = element.attributes["id"],
-            let nameStr = element.attributes["name"],
-            let friendlyNameStr = element.attributes["friendlyname"],
-            let valueStr = element.attributes["value"],
-            let bayesAverageStr = element.attributes["bayesaverage"]
-                else {
-                    throw XMLDeserializationError.TypeConversionFailed(type: "GameRank", element: element)
-        }
-
-        guard let id = Int(idStr), value = Int(valueStr), bayesAverage = Double(bayesAverageStr)
-            else {
-                throw XMLDeserializationError.TypeConversionFailed(type: "GameRank", element: element)
-        }
-
-        return GameRank(
-            type: typeStr,
-            id: id,
-            name: nameStr,
-            friendlyName: friendlyNameStr,
-            value: value,
-            bayesAverage: bayesAverage)
-    }
-}
+        return try GameRank(
+            type: element.attribute("type"),
+            id: element.attribute("id"),
+            name: element.attribute("name"),
+            friendlyName: element.attribute("friendlyname"),
+            value: element.attribute("value"),
+            bayesAverage: element.attribute("bayesaverage")
+        )
+    }
+}
+
+extension XMLElement {
+
+    // Int
+    public func attribute(attribute: String) throws -> Int {
+        guard let attributeStr = self.attributes[attribute], let ret = Int(attributeStr) else {
+            throw XMLDeserializationError.NodeHasNoValue
+        }
+        return ret
+    }
+    // Int?
+    public func attribute(attribute: String) throws -> Int? {
+        if let attributeStr = self.attributes[attribute] {
+            return Int(attributeStr)
+        }
+        return nil
+    }
+
+    // Double
+    public func attribute(attribute: String) throws -> Double {
+        guard let attributeStr = self.attributes[attribute], let ret = Double(attributeStr) else {
+            throw XMLDeserializationError.NodeHasNoValue
+        }
+        return ret
+    }
+    // Double?
+    public func attribute(attribute: String) throws -> Double? {
+        if let attributeStr = self.attributes[attribute] {
+            return Double(attributeStr)
+        }
+        return nil
+    }
+
+    // String
+    public func attribute(attribute: String) throws -> String {
+        guard let ret = self.attributes[attribute] else {
+            throw XMLDeserializationError.NodeHasNoValue
+        }
+        return ret
+    }
+    // String?
+    public func attribute(attribute: String) throws -> String? {
+        if let attributeStr = self.attributes[attribute] {
+            return attributeStr
+        }
+        return nil
+    }
+
+    // Bool
+    public func attribute(attribute: String) throws -> Bool {
+        guard let attributeStr = self.attributes[attribute] else {
+            throw XMLDeserializationError.NodeHasNoValue
+        }
+        return NSString(string: attributeStr).boolValue
+    }
+    // Bool?
+    public func attribute(attribute: String) throws -> Bool? {
+        if let attributeStr = self.attributes[attribute] {
+            return NSString(string: attributeStr).boolValue
+        }
+        return nil
+    }
+}

     - returns: A CollectionStats structure.
     */
    public static func deserialize(node: XMLIndexer) throws -> CollectionRating {
        guard let userRatingStr = node.element?.attributes["value"],
            let averageRatingStr = node["average"].element?.attributes["value"],
            let bayesAverageRatingStr = node["bayesaverage"].element?.attributes["value"]
                else {
                    throw XMLDeserializationError.NodeIsInvalid(node: node)
        }

        guard let averageRating = Double(averageRatingStr),
            let bayesAverageRating = Double(bayesAverageRatingStr)
                else {
                    throw XMLDeserializationError.NodeIsInvalid(node: node)
        }

        var stdDev: Double? = nil
        if let stdDevStr = node["stddev"].element?.attributes["value"] {
            stdDev = Double(stdDevStr)
        }

        var median: Double? = nil
        if let medianStr = node["median"].element?.attributes["value"] {
            median = Double(medianStr)
        }

        var usersRated: Int? = nil
        if let usersRatedStr = node["usersrated"].element?.attributes["value"] {
            usersRated = Int(usersRatedStr)
        }

        return try CollectionRating(
            userRating: Double(userRatingStr),
            usersRated: usersRated,
            averageRating: averageRating,
            bayesAverageRating: bayesAverageRating,
            stdDev: stdDev,
            median: median,
            ranks: node["ranks"]["rank"].value()
        )
    }


     - returns: A CollectionStatus structure.
     */
    public static func deserialize(element: XMLElement) throws -> CollectionStatus {
        return try CollectionStatus(
            owned: element.attribute("own"),
            prevOwned: element.attribute("prevowned"),
            wantToBuy: element.attribute("wanttobuy"),
            wantToPlay: element.attribute("wanttoplay"),
            preOrdered: element.attribute("preordered"),
            wantInTrade: element.attribute("want"),
            forTrade: element.attribute("fortrade"),
            wishList: element.attribute("wishlist"),
            wishListPriority: element.attribute("wishlistpriority"),
            lastModified: element.attribute("lastmodified")
        )
    }
}

