/// <summary>
        /// Generates classes for the schemaFileName specified.
        /// </summary>
        public override void Execute()
        {
            // Load the XmlSchema and its collection.
            XmlSchema xsd;
            string    xsdImportPath;

            using (FileStream fs = new FileStream(this.xsdFile, FileMode.Open))
            {
                xsd = XmlSchema.Read(fs, null);
                XmlSchemaSet schemaSet = new XmlSchemaSet();
                schemaSet.Add(xsd);

                foreach (XmlSchemaImport import in xsd.Includes)
                {
                    xsdImportPath = ResolveImportPath(import);

                    using (FileStream fsSchemaImport = new FileStream(xsdImportPath, FileMode.Open))
                    {
                        XmlSchema xsdTemp = XmlSchema.Read(fsSchemaImport, null);
                        schemaSet.Add(xsdTemp);
                    }
                }

                schemaSet.Compile();
            }

            XmlSchemas schemas = new XmlSchemas();

            schemas.Add(xsd);

            foreach (XmlSchemaImport import in xsd.Includes)
            {
                xsdImportPath = ResolveImportPath(import);

                using (FileStream fs = new FileStream(xsdImportPath, FileMode.Open))
                {
                    XmlSchema xsdTemp = XmlSchema.Read(fs, null);
                    schemas.Add(xsdTemp);
                }
            }

            // Create the importer for these schemas.
            XmlSchemaImporter importer = new XmlSchemaImporter(schemas);

            // System.CodeDom namespace for the XmlCodeExporter to put classes in.
            CodeNamespace   ns       = new CodeNamespace(this.targetNamespace);
            XmlCodeExporter exporter = new XmlCodeExporter(ns);

            List <XmlTypeMapping> mappings = new List <XmlTypeMapping>();

            foreach (XmlSchemaType type in xsd.SchemaTypes.Values)
            {
                mappings.Add(importer.ImportSchemaType(type.QualifiedName));
            }

            if (!this.ProcessComplexTypesOnly)
            {
                foreach (XmlSchemaElement element in xsd.Elements.Values)
                {
                    mappings.Add(importer.ImportTypeMapping(element.QualifiedName));
                }
            }

            foreach (XmlTypeMapping mapping in mappings)
            {
                exporter.ExportTypeMapping(mapping);
            }

            CodeGenerator.ValidateIdentifiers(ns);

            compileUnit = new CodeCompileUnit();

            schemas.Remove(xsd);

            //Remove Types from CodeCompileUnit that belong to the imported schemas
            RemoveTypes(schemas, ns);

            compileUnit.Namespaces.Add(ns);
        }