     
     public func processGradientDefs(xmlElement: NSXMLElement, state: State) throws -> SVGLinearGradient? {
         let stops = try processGradientStops(xmlElement.children)
-        let x1 = try SVGProcessor.stringToOptionalCGFloat(xmlElement["x1"]?.stringValue)
-        let y1 = try SVGProcessor.stringToOptionalCGFloat(xmlElement["y1"]?.stringValue)
-        let x2 = try SVGProcessor.stringToOptionalCGFloat(xmlElement["x2"]?.stringValue)
-        let y2 = try SVGProcessor.stringToOptionalCGFloat(xmlElement["y2"]?.stringValue)
+        let x1 = try SVGProcessor.stringToCGFloat(xmlElement["x1"]?.stringValue, defaultVal: 0.0)
+        let y1 = try SVGProcessor.stringToCGFloat(xmlElement["y1"]?.stringValue, defaultVal: 0.0)
+        let x2 = try SVGProcessor.stringToCGFloat(xmlElement["x2"]?.stringValue, defaultVal: 1.0)
+        let y2 = try SVGProcessor.stringToCGFloat(xmlElement["y2"]?.stringValue, defaultVal: 1.0)
 
         xmlElement["x1"] = nil
         xmlElement["y1"] = nil

            return SVGGradientStop(offset: offset, opacity: stopOpacity, color: color)
        }

        guard let colorNode = xmlElement["stop-color"] else {
            throw Error.missingRequiredSVGProperty(#file, #function, #line)
        }
        guard let colorString = colorNode.stringValue else {
            throw Error.corruptXML(#file, #function, #line)
        }
        guard let stopColorDict = SVGProcessor.processColorString(colorString, opacity: .None),
            var stopColor = SVGColors.colorDictionaryToCGColor(stopColorDict) else {
            throw Error.invalidSVG(#file, #function, #line)

    }
    
    private class func stringToCGFloat(string: String?, defaultVal: CGFloat) throws -> CGFloat {
        guard let stringValue = string else {
            return defaultVal
        }
        return try stringToCGFloat(stringValue)
    }
    
    private class func percentageStringToCGFloat(string: String?) throws -> CGFloat {
