     }
     
     public func toGaxbString() -> String {
+        var r:CGFloat = 0, g:CGFloat = 0, b:CGFloat = 0, a:CGFloat = 0
+        if self.getRed(&r, green:&g , blue: &b, alpha: &a) {
+            let hexNumber = Int(r*255) << 24 + Int(g*255) << 16 + Int(b*255) << 8 + Int(a*255)
+            return NSString(format:"#%08X", hexNumber)
+        }
         return ""
     }
 }

    }
}

extension UIImage {
    convenience init?(validateAndLoad name: String!) {
        self.init(named: name)

//
//  GaxbTypes.swift
//  Copyright (c) 2014 Small Planet. All rights reserved.
//

import UIKit

// MARK: XSD datatypes

extension Bool: GaxbType {
    public init(gaxbString: String) {
        self.init()
        self.setWithGaxbString(gaxbString)
    }
    public mutating func setWithGaxbString(gaxbString: String) {
        switch gaxbString {
        case "true": self = true
        default: self = false
        }
    }
    public func toGaxbString() -> String {
        return self ? "true" : "false"
    }
}

// MARK: GAXB-defined types

extension CGRect: GaxbType {
    public init(gaxbString withGaxbString: String) {
