public static void Parse(IBDocument ibDocument, XElement xElement)
        {
            NSObjectDecoder nsObjDecoder = new NSObjectDecoder(ibDocument, xElement);

            string keyVal = xElement.Attribute("key").Value.Substring(11);
            switch (keyVal)
            {
                case "SystemTarget":
                    {
                        //ibDocument.SystemTarget = (NSNumber)nsObjDecoder.Create(xElement);
                        ibDocument.SystemTarget = (NSNumber)nsObjDecoder.Create();
                    }
                    break;
                case "SystemVersion":
                    {
                        ibDocument.SystemVersion = (NSString)nsObjDecoder.Create();
                    }
                    break;
                case "InterfaceBuilderVersion":
                    {
                        ibDocument.InterfaceBuilderVersion = (NSString)nsObjDecoder.Create();
                    }
                    break;
                case "AppKitVersion":
                    {
                        ibDocument.AppKitVersion = (NSString)nsObjDecoder.Create();
                    }
                    break;
                case "HIToolboxVersion":
                    {
                        ibDocument.HIToolboxVersion = (NSString)nsObjDecoder.Create();
                    }
                    break;
                case "PluginVersions":
                    {
                        ibDocument.PluginVersions = (NSMutableDictionary)nsObjDecoder.Create();
                    }
                    break;
                case "IntegratedClassDependencies":
                    {
                        ibDocument.IntegratedClassDependencies = (NSArray)nsObjDecoder.Create();
                    }
                    break;
                case "PluginDependencies":
                    {
                        ibDocument.PluginDependencies = (NSArray)nsObjDecoder.Create();
                    }
                    break;
                case "Metadata":
                    {
                        ibDocument.Metadata = (NSMutableDictionary)nsObjDecoder.Create();
                    }
                    break;
                case "RootObjects":
                    {
                        ibDocument.RootObjects = (NSMutableArray)nsObjDecoder.Create();
                        ibDocument.ResolveReferences();
                    }
                    break;
                case "Objects":
                    {
                        ibDocument.Objects = (IBObjectContainer)nsObjDecoder.Create();
                    }
                    break;
                case "Classes":
                    {
                        ibDocument.Classes = (IBClassDescriber)nsObjDecoder.Create();
                    }
                    break;
                case "localizationMode":
                    {
                        ibDocument.LocalizationMode = (NSNumber)nsObjDecoder.Create();
                    }
                    break;
                case "TargetRuntimeIdentifier":
                    {
                        ibDocument.TargetRuntimeIdentifier = (NSString)nsObjDecoder.Create();
                    }
                    break;
                case "PluginDeclaredDevelopmentDependencies":
                    {
                        ibDocument.PluginDeclaredDevelopmentDependencies = (NSMutableDictionary)nsObjDecoder.Create();
                    }
                    break;
                case "PluginDeclaredDependenciesTrackSystemTargetVersion":
                    {
                        ibDocument.PluginDeclaredDependenciesTrackSystemTargetVersion = (NSNumber)nsObjDecoder.Create();
                    }
                    break;
                case "defaultPropertyAccessControl":
                     {
                         ibDocument.DefaultPropertyAccessControl = (NSNumber)nsObjDecoder.Create();
                    }
                    break;
                case "LastKnownImageSizes":
                    {
                        ibDocument.LastKnownImageSizes = (NSMutableDictionary)nsObjDecoder.Create();
                    }
                    break;

                default:
                    System.Diagnostics.Debug.WriteLine("IBDocument : unknown key " + keyVal);
                    break;
            }
        }
        private object CreateFromClassName(XElement xElement, string attrClass)
        {
            NSCoding2 nsObj = null;

            NSObjectDecoder decoder = new NSObjectDecoder(Document, xElement);

            System.Diagnostics.Debug.WriteLine(attrClass);

            Type t = Type.GetType("Smartmobili.Cocoa." + attrClass);
            if (t != null)
            {
                nsObj = Activator.CreateInstance(t) as NSCoding2;
                if (nsObj != null)
                {
                    //nsObj = (NSCoding2)nsObj.InitWithCoder(decoder);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(string.Format(
                        "CreateFromClassName : this class name {0} doesn't implement NSCoding protocol", attrClass));
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(
                        string.Format("CreateFromClassName : Unknown <object> class name {0}", attrClass));
            }

            //switch (attrClass)
            //{
            //    case "IBActionConnection": { nsObj = new IBActionConnection(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBActionInfo": { nsObj = new IBActionInfo(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBBindingConnection": { nsObj = new IBBindingConnection(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBClassDescriber": { nsObj = new IBClassDescriber(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBClassDescriptionSource": { nsObj = new IBClassDescriptionSource(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBConnectionRecord": { nsObj = new IBConnectionRecord(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBMutableOrderedSet": { nsObj = new IBMutableOrderedSet(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBObjectContainer": { nsObj = new IBObjectContainer(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBObjectRecord": { nsObj = new IBObjectRecord(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBOutletConnection": { nsObj = new IBOutletConnection(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBPartialClassDescription": { nsObj = new IBPartialClassDescription(); nsObj.InitWithCoder(decoder); break; }
            //    case "IBToOneOutletInfo": { nsObj = new IBToOneOutletInfo(); nsObj.InitWithCoder(decoder); break; }

            //    case "NSArray": { nsObj = new NSArray(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSArrayController": { nsObj = new NSArrayController(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSBox": { nsObj = new NSBox(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSButton": { ;break; }
            //    case "NSButtonCell": { ;break; }
            //    case "NSClipView": { nsObj = new NSClipView(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSCollectionView": { nsObj = new NSCollectionView(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSCollectionViewItem": { nsObj = new NSCollectionViewItem(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSColor": { ;break; }
            //    case "NSCustomObject": { nsObj = new NSCustomObject(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSCustomResource": { nsObj = new NSCustomResource(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSCustomView": { nsObj = new NSCustomView(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSFont": { ;break; }
            //    case "NSMenu": { nsObj = new NSMenu(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSMenuItem": { nsObj = new NSMenuItem(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSMutableArray": { nsObj = new NSMutableArray(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSMutableDictionary": { nsObj = new NSMutableDictionary(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSMutableString": { nsObj = new NSMutableString(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSNibBindingConnector": { nsObj = new NSNibBindingConnector(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSPopUpButton": { ;break; }
            //    case "NSPopUpButtonCell": { ;break; }
            //    case "NSScroller": { nsObj = new NSScroller(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSScrollView": { nsObj = new NSScrollView(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSSegmentedCell": { ;break; }
            //    case "NSSegmentedControl": { ;break; }
            //    case "NSSegmentItem": { ;break; }
            //    case "NSTextField": { nsObj = new NSTextField(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSTextFieldCell": { nsObj = new NSTextFieldCell(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSToolbar": { nsObj = new NSToolbar(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSToolbarFlexibleSpaceItem": { nsObj = new NSToolbarFlexibleSpaceItem(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSToolbarItem": { nsObj = new NSToolbarItem(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSToolbarSeparatorItem": { nsObj = new NSToolbarSeparatorItem(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSToolbarSpaceItem": { nsObj = new NSToolbarSpaceItem(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSView": { nsObj = new NSView(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSViewController": { nsObj = new NSViewController(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSWindowTemplate": { nsObj = new NSWindowTemplate(); nsObj.InitWithCoder(decoder); break; }
            //    case "NSWindowView": { ;break; }

            //    default:
            //        System.Diagnostics.Debug.WriteLine(
            //            string.Format("Unknown <object> class name {0}", attrClass));
            //        break;
            //}

            return nsObj;
        }