static void Main(string[] args)
        {

            XmlSchema rootSchema = GetSchemaFromFile("fpml-ird-5-4.xsd");
            using (var writer = new StringWriter())
            {
                
                foreach (XmlSchemaObject item in rootSchema.Items)
                {
                    if (item is XmlSchemaElement)
                    {
                        XmlSchemaElement xe = item as XmlSchemaElement;
                    }
                    else if (item is XmlSchemaComplexType)
                    {
                        XmlSchemaComplexType xsct = item as XmlSchemaComplexType;
                        CppCodeGen.Generator gen = new Generator(xsct);
                        gen.makeCode();
                        writer.WriteLine(gen.Code);
                        
    
                    }
                 }

            File.WriteAllText(Path.Combine(rootFolder, "genCode.hpp"), writer.GetStringBuilder().ToString());

            }
        }
        private void Generation(string xsdFileName) 
        {
            string subfoler = xsdFileName.Replace(".xsd","");
            string subBuiltInPath = System.IO.Path.Combine(rootFolder_, subfoler);
            System.IO.Directory.CreateDirectory(subBuiltInPath);

            XmlSchema rootSchema = GetSchemaFromFile(xsdFileName);

            var allIncludeWriter = new StringWriter();
            bool noUseFile = false;

            try
            {
                foreach (XmlSchemaObject item in rootSchema.Items)
                {

                    var hppWriter = new StringWriter();
                    var cppWriter = new StringWriter();

                    string schemaObjectName = "";

                    if (item is XmlSchemaElement)
                    {
                        XmlSchemaElement xe = item as XmlSchemaElement;
                        schemaObjectName = xe.Name + "NoUseFile";
                        noUseFile = true;
                    }
                    else if (item is XmlSchemaComplexType)
                    {
                        

                        XmlSchemaComplexType xsct = item as XmlSchemaComplexType;

                        if (this.filterStr_.Contains(xsct.Name) || this.filterStr_ == "")
                        {

                            //debug
                            Console.WriteLine(xsct.Name);
                            CppCodeGen.Generator gen = new Generator(xsct, elementRef, includePath, elementSubstitutionRef, elementGroupRef);
                            gen.makeCode();
                            hppWriter.WriteLine(gen.HppCode);
                            cppWriter.WriteLine(gen.CppCode);
                            schemaObjectName = xsct.Name;
                        }
                    }
                    else if (item is XmlSchemaSimpleType)
                    {
                        XmlSchemaSimpleType xsst = item as XmlSchemaSimpleType;
                        CppCodeGen.GeneratorSimple gen = new GeneratorSimple(xsst);
                        hppWriter.WriteLine(gen.Code);
                        schemaObjectName = xsst.Name;
                    }

                    if (!noUseFile)
                    {
                        File.WriteAllText(Path.Combine(subBuiltInPath, schemaObjectName + ".hpp"), hppWriter.GetStringBuilder().ToString());
                        File.WriteAllText(Path.Combine(subBuiltInPath, schemaObjectName + ".cpp"), cppWriter.GetStringBuilder().ToString());
                        string includeCode = "#include <" + relFolder_ + subfoler + "\\" + schemaObjectName + ".hpp>";
                        allIncludeWriter.WriteLine(includeCode);
                    }

                }

                File.WriteAllText(Path.Combine(subBuiltInPath, "all.hpp"), allIncludeWriter.GetStringBuilder().ToString());
                //File.WriteAllText(Path.Combine(subBuiltInPath, built_in_type_subfoler + ".hpp"), writer.GetStringBuilder().ToString());
            }
            catch 
            {
                Console.WriteLine("errorOcc -----------------------------------------------------------");
                Console.ReadLine();
            }
        }