private void IterateOverElement( string root, XmlSchemaElement element )
        {
            var complexType = element.SchemaType as XmlSchemaComplexType;
            if (complexType == null) return;
            if (complexType.AttributeUses.Count > 0)
            {
                IDictionaryEnumerator enumerator = complexType.AttributeUses.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    var attribute = (XmlSchemaAttribute) enumerator.Value;
                    Console.WriteLine( root + @"." + attribute.Name + @" (attribute)" );
                }
            }
            XmlSchemaContentModel contentModel = complexType.ContentModel;
            if (contentModel == null) return;
            XmlSchemaContent content = contentModel.Content;
            if (content is XmlSchemaComplexContentExtension)
            {
                var ext = (XmlSchemaComplexContentExtension) content;

                XmlQualifiedName baseTypeField = ext.BaseTypeName;
                _baseSignalName = baseTypeField.Name;
                _baseSignalNameSpace = baseTypeField.Namespace; //Need to get the base target namespace

                foreach (XmlSchemaObject o in ext.Attributes)
                {
                    var attribute = (XmlSchemaAttribute) o;
                    XmlSchemaAnnotation annotation = attribute.Annotation;
                    XmlSchemaType schemaType = attribute.SchemaType;
                    String defaultValue = attribute.DefaultValue;
                    String fixedValue = attribute.FixedValue;
                    String name = attribute.Name;
                    var signalAttribute = new SignalAttribute( name );
                    signalAttribute.DefaultValue = defaultValue;
                    signalAttribute.FixedValue = fixedValue;
                    signalAttribute.SchemaType = attribute.SchemaTypeName.Name;
                    _attributes.Add( signalAttribute );

                    //Add AttributeRestrictions here
                    if (schemaType is XmlSchemaSimpleType)
                    {
                        var simpleType = (XmlSchemaSimpleType) schemaType;
                        XmlSchemaSimpleTypeContent simpleContent = simpleType.Content;
                        foreach (XmlAttribute ua in simpleContent.UnhandledAttributes)
                        {
                            //if( "minInclusive".Equals( ua.LocalName )
                            //    restriction = new RangeRestriction(
                            //Console.WriteLine("\t\t\t\t" + ua.Name + "\t\t" + ua.Value);
                            var restriction = new AttributeRestriction( ua );
                            signalAttribute.AddRestriction( restriction );
                        }
                    }
                }
            }
        }
        private void IterateOverElement(string root, XmlSchemaElement element)
        {
            var complexType = element.SchemaType as XmlSchemaComplexType;

            if (complexType == null)
            {
                return;
            }
            if (complexType.AttributeUses.Count > 0)
            {
                IDictionaryEnumerator enumerator = complexType.AttributeUses.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    var attribute = (XmlSchemaAttribute)enumerator.Value;
                    Console.WriteLine(root + @"." + attribute.Name + @" (attribute)");
                }
            }
            XmlSchemaContentModel contentModel = complexType.ContentModel;

            if (contentModel == null)
            {
                return;
            }
            XmlSchemaContent content = contentModel.Content;

            if (content is XmlSchemaComplexContentExtension)
            {
                var ext = (XmlSchemaComplexContentExtension)content;

                XmlQualifiedName baseTypeField = ext.BaseTypeName;
                _baseSignalName      = baseTypeField.Name;
                _baseSignalNameSpace = baseTypeField.Namespace; //Need to get the base target namespace

                foreach (XmlSchemaObject o in ext.Attributes)
                {
                    var attribute = (XmlSchemaAttribute)o;
                    XmlSchemaAnnotation annotation = attribute.Annotation;
                    XmlSchemaType       schemaType = attribute.SchemaType;
                    String defaultValue            = attribute.DefaultValue;
                    String fixedValue      = attribute.FixedValue;
                    String name            = attribute.Name;
                    var    signalAttribute = new SignalAttribute(name);
                    signalAttribute.DefaultValue = defaultValue;
                    signalAttribute.FixedValue   = fixedValue;
                    signalAttribute.SchemaType   = attribute.SchemaTypeName.Name;
                    _attributes.Add(signalAttribute);

                    //Add AttributeRestrictions here
                    if (schemaType is XmlSchemaSimpleType)
                    {
                        var simpleType = (XmlSchemaSimpleType)schemaType;
                        XmlSchemaSimpleTypeContent simpleContent = simpleType.Content;
                        foreach (XmlAttribute ua in simpleContent.UnhandledAttributes)
                        {
                            //if( "minInclusive".Equals( ua.LocalName )
                            //    restriction = new RangeRestriction(
                            //Console.WriteLine("\t\t\t\t" + ua.Name + "\t\t" + ua.Value);
                            var restriction = new AttributeRestriction(ua);
                            signalAttribute.AddRestriction(restriction);
                        }
                    }
                }
            }
        }