当前位置: 首页>>代码示例>>C#>>正文


C# XmlSchema.Compile方法代码示例

本文整理汇总了C#中System.Xml.Schema.XmlSchema.Compile方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchema.Compile方法的具体用法?C# XmlSchema.Compile怎么用?C# XmlSchema.Compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Schema.XmlSchema的用法示例。


在下文中一共展示了XmlSchema.Compile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestAdd

		public void TestAdd ()
		{
			XmlSchemaCollection col = new XmlSchemaCollection ();
			XmlSchema schema = new XmlSchema ();
			XmlSchemaElement elem = new XmlSchemaElement ();
			elem.Name = "foo";
			schema.Items.Add (elem);
			schema.TargetNamespace = "urn:foo";
			col.Add (schema);
			col.Add (schema);	// No problem !?

			XmlSchema schema2 = new XmlSchema ();
			schema2.Items.Add (elem);
			schema2.TargetNamespace = "urn:foo";
			col.Add (schema2);	// No problem !!

			schema.Compile (null);
			col.Add (schema);
			col.Add (schema);	// Still no problem !!!

			schema2.Compile (null);
			col.Add (schema2);

			schema = GetSchema ("Test/XmlFiles/xsd/3.xsd");
			schema.Compile (null);
			col.Add (schema);

			schema2 = GetSchema ("Test/XmlFiles/xsd/3.xsd");
			schema2.Compile (null);
			col.Add (schema2);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:31,代码来源:XmlSchemaCollectionTests.cs

示例2: CreateSimpletypeLength

    private void CreateSimpletypeLength(string length, string minLength, string maxLength, bool expected) {
      passed = true;

      XmlSchema schema = new XmlSchema();

      XmlSchemaSimpleType testType = new XmlSchemaSimpleType();
      testType.Name = "TestType";

      XmlSchemaSimpleTypeRestriction testTypeRestriction = new XmlSchemaSimpleTypeRestriction();
      testTypeRestriction.BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");

      if (length != "-") {
        XmlSchemaLengthFacet _length = new XmlSchemaLengthFacet();
        _length.Value = length;
        testTypeRestriction.Facets.Add(_length);
      }
      if (minLength != "-") {
        XmlSchemaMinLengthFacet _minLength = new XmlSchemaMinLengthFacet();
        _minLength.Value = minLength;
        testTypeRestriction.Facets.Add(_minLength);
      }
      if (maxLength != "-") {
        XmlSchemaMaxLengthFacet _maxLength = new XmlSchemaMaxLengthFacet();
        _maxLength.Value = maxLength;
        testTypeRestriction.Facets.Add(_maxLength);
      }

      testType.Content = testTypeRestriction;
      schema.Items.Add(testType);
      schema.Compile(new ValidationEventHandler(ValidationCallbackOne));

      Assert.IsTrue (expected == passed, (passed ? "Test passed, should have failed" : "Test failed, should have passed") + ": " + length + " " + minLength + " " + maxLength);
      
    }
开发者ID:nobled,项目名称:mono,代码行数:34,代码来源:XmlSchemaLengthFacetTests.cs

示例3: SetUpFixture

 public void SetUpFixture()
 {
     string relativePath = "../../../TestFiles/log4net.xsd";
     Assert.IsTrue(File.Exists(relativePath), string.Format("File does not exist {0}", relativePath));
     xmlSchema = XmlSchema.Read(new XmlTextReader(relativePath), null);
     xmlSchema.Compile(null);
     provider = new SchemaParameterDescriptorProvider(xmlSchema);
 }
开发者ID:willrawls,项目名称:arp,代码行数:8,代码来源:SchemaParameterDescriptorProviderTests.cs

示例4: LoadSchema

 private static XmlSchema LoadSchema()
 {
   var schema = new XmlSchema();
   using (var stream = typeof(XmlCompletionDataProvider).Assembly.GetManifestResourceStream("InnovatorAdmin.Editor.xslt.xsd"))
   {
     using (var reader = XmlReader.Create(stream))
     {
       schema = XmlSchema.Read(reader, new ValidationEventHandler(SchemaValidation));
       schema.Compile(new ValidationEventHandler(SchemaValidation));
     }
   }
   return schema;
 }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:13,代码来源:ImportXsltHelper.cs

示例5: WhiteSpaceTest

    /* Takes a type name, and a valid example of that type, 
       Creates a schema consisting of a single element of that
       type, and validates a bit of xml containing the valid 
       value, with whitespace against that schema.
     
FIXME: Really we want to test the value of whitespace more
       directly that by creating a schema then parsing a string.
     
     */

    public void WhiteSpaceTest(string type, string valid) {
      passed = true;
      XmlSchema schema = new XmlSchema();

      schema.TargetNamespace= "http://example.com/testCase";
      XmlSchemaElement element = new XmlSchemaElement();
      element.Name = "a";
      element.SchemaTypeName = new XmlQualifiedName(type, "http://www.w3.org/2001/XMLSchema");
      schema.Items.Add(element);
      schema.Compile(new ValidationEventHandler(ValidationCallbackOne));

      XmlValidatingReader vr = new XmlValidatingReader(new XmlTextReader(new StringReader("<a xmlns='http://example.com/testCase'>\n\n"+valid+"\n\n</a>" )));
      vr.Schemas.Add(schema);
      vr.ValidationType = ValidationType.Schema;
//      vr.ValidationEventHandler += new ValidationEventHandler(ValidationCallbackOne);
      while(vr.Read()) { };
      vr.Close();
      
      Assert(type + " doesn't collapse whitespace: " + (errorInfo != null ? errorInfo.Message : null), passed);
    }
开发者ID:kumpera,项目名称:mono,代码行数:30,代码来源:XmlSchemaBuiltInDatatypeTests.cs

示例6: Main

		public static void Main (string[] args)
		{
			if (args.Length < 2) {
				PrintUsage ();
			}

			Stream s = null;

			switch (args[0]) {
				case "ecma":
					s = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("monodoc-ecma.xsd");
					break;
				default:
					Console.WriteLine ("Unknown provider: {0}", args[0]);
					Environment.Exit (0);
					break;
			}

			if (s == null) {
				Console.WriteLine ("ERROR: schema for {0} was not found", args[0]);
				Environment.Exit (1);
			}

			schema = XmlSchema.Read (s, null);
			schema.Compile (null);

			// skip args[0] because it is the provider name
			for (int i = 1; i < args.Length; i++) {
				string arg = args[i];
				if (IsMonodocFile (arg))
					ValidateFile (arg);

				if (Directory.Exists (arg))
				{
					RecurseDirectory (arg);
				}
			}

			Console.WriteLine ("Total validation errors: {0}", errors);
		}
开发者ID:emtees,项目名称:old-code,代码行数:40,代码来源:validate.cs

示例7: XssFilterInfo

        internal XssFilterInfo(string schemaLocation)
        {
            XmlDocument schemaDoc = GetSchemaDoc(schemaLocation);
            XmlReader schemaReader = new XmlNodeReader(schemaDoc);
            try
            {
                Schema = XmlSchema.Read(schemaReader, null);
            }
            finally
            {
                schemaReader.Close();
            }

            Schema.Compile(null);
            if (Type.GetType("Mono.Runtime", false) != null)
            {
                UriAndStyleValidator = new AttributeValueValidator();
                UriAndStyleValidator.Add(schemaDoc, Schema, "URI", Schema.TargetNamespace);
                UriAndStyleValidator.Add(schemaDoc, Schema, "InlineStyle", Schema.TargetNamespace);
                // NOTE: We don't bother with attributes of type "URIs" (plural) because only <object> has such an
                // attribute and we don't allow that element.
            }
        }
开发者ID:joeaudette,项目名称:mojoportal,代码行数:23,代码来源:XssFilterInfo.cs

示例8: XmlSchemaDataImporter

		static XmlSchemaDataImporter ()
		{
			XmlSchema s = new XmlSchema ();
			XmlSchemaAttribute a = new XmlSchemaAttribute ();
			a.Name = "foo";
			a.SchemaTypeName = new XmlQualifiedName ("integer", XmlSchema.Namespace);
			s.Items.Add (a);
			XmlSchemaAttribute b = new XmlSchemaAttribute ();
			b.Name = "bar";
			b.SchemaTypeName = new XmlQualifiedName ("decimal", XmlSchema.Namespace);
			s.Items.Add (b);
			XmlSchemaElement e = new XmlSchemaElement ();
			e.Name = "bar";
			s.Items.Add (e);
			s.Compile (null);
			schemaIntegerType = a.AttributeType as XmlSchemaDatatype;
			schemaDecimalType = b.AttributeType as XmlSchemaDatatype;
			schemaAnyType = e.ElementType as XmlSchemaComplexType;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:19,代码来源:XmlSchemaDataImporter.cs

示例9: Find

		object Find (XmlSchema schema, XmlQualifiedName name, Type type)
		{
			if (!schema.IsCompiled) {
				schema.Compile (null);
			}

			XmlSchemaObjectTable tbl = null;

			if (type == typeof (XmlSchemaSimpleType) || type == typeof (XmlSchemaComplexType))
				tbl = schema.SchemaTypes;
			else if (type == typeof (XmlSchemaAttribute))
				tbl = schema.Attributes;
			else if (type == typeof (XmlSchemaAttributeGroup))
				tbl = schema.AttributeGroups;
			else if (type == typeof (XmlSchemaElement))
				tbl = schema.Elements;
			else if (type == typeof (XmlSchemaGroup))
				tbl = schema.Groups;
			else if (type == typeof (XmlSchemaNotation))
				tbl = schema.Notations;

			object res = (tbl != null) ? tbl [name] : null;
			if (res != null && res.GetType () != type) return null;
			else return res;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:25,代码来源:XmlSchemas.cs

示例10: ReadSchema

		/// <summary>
		/// Loads the schema.
		/// </summary>
		void ReadSchema(XmlReader reader)
		{
			try	{
				schema = XmlSchema.Read(reader, new ValidationEventHandler(SchemaValidation));
				schema.Compile(new ValidationEventHandler(SchemaValidation));
			
				namespaceUri = schema.TargetNamespace;
			} finally {
				reader.Close();
			}
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:14,代码来源:XmlSchemaCompletionData.cs

示例11: TestCompile_ZeroLength_TargetNamespace

		public void TestCompile_ZeroLength_TargetNamespace ()
		{
			XmlSchema schema = new XmlSchema ();
			schema.TargetNamespace = string.Empty;
			Assert.IsTrue (!schema.IsCompiled);

			// MS.NET 1.x: The Namespace '' is an invalid URI.
			// MS.NET 2.0: The targetNamespace attribute cannot have empty string as its value.
			schema.Compile (null);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:10,代码来源:XmlSchemaTests.cs

示例12: Generate

        /// <summary>
        /// Generates strongly typed serialization classes for the given schema document
        /// under the given namespace and generates a code compile unit.
        /// </summary>
        /// <param name="xmlSchema">Schema document to generate classes for.</param>
        /// <param name="generateNamespace">Namespace to be used for the generated code.</param>
        /// <returns>A fully populated CodeCompileUnit, which can be serialized in the language of choice.</returns>
        public static CodeCompileUnit Generate(XmlSchema xmlSchema, string generateNamespace)
        {
            if (xmlSchema == null)
            {
                throw new ArgumentNullException("xmlSchema");
            }
            if (generateNamespace == null)
            {
                throw new ArgumentNullException("generateNamespace");
            }

            simpleTypeNamesToClrTypeNames = new Hashtable();
            typeNamesToEnumDeclarations = new Hashtable();

            CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
            CodeNamespace codeNamespace = new CodeNamespace(generateNamespace);
            codeCompileUnit.Namespaces.Add(codeNamespace);
            codeNamespace.Imports.Add(new CodeNamespaceImport("System"));
            codeNamespace.Imports.Add(new CodeNamespaceImport("System.Collections"));
            codeNamespace.Imports.Add(new CodeNamespaceImport("System.Xml"));

            simpleTypeNamesToClrTypeNames.Add("dateTime", "DateTime");
            simpleTypeNamesToClrTypeNames.Add("uint", "uint");
            simpleTypeNamesToClrTypeNames.Add("int", "int");
            simpleTypeNamesToClrTypeNames.Add("integer", "int");
            simpleTypeNamesToClrTypeNames.Add("NMTOKEN", "string");
            simpleTypeNamesToClrTypeNames.Add("nonNegativeInteger", "uint");
            simpleTypeNamesToClrTypeNames.Add("string", "string");

            xmlSchema.Compile(null);

            foreach (XmlSchemaObject schemaObject in xmlSchema.SchemaTypes.Values)
            {
                XmlSchemaComplexType schemaComplexType = schemaObject as XmlSchemaComplexType;
                if (schemaComplexType != null)
                {
                    ProcessComplexType(schemaComplexType, codeNamespace);
                }

                XmlSchemaSimpleType schemaSimpleType = schemaObject as XmlSchemaSimpleType;
                if (schemaSimpleType != null)
                {
                    ProcessSimpleType(schemaSimpleType, codeNamespace);
                }
            }

            foreach (XmlSchemaObject schemaObject in xmlSchema.Elements.Values)
            {
                XmlSchemaElement schemaElement = schemaObject as XmlSchemaElement;
                if (schemaElement != null)
                {
                    ProcessElement(schemaElement, codeNamespace);
                }
            }

            return codeCompileUnit;
        }
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:64,代码来源:StronglyTypedClasses.cs

示例13: XsdSimpleRestrictionType

		public XsdSimpleRestrictionType (RelaxngDatatype primitive, RelaxngParamList parameters)
		{
			type = new XmlSchemaSimpleType ();
			XmlSchemaSimpleTypeRestriction r =
				new XmlSchemaSimpleTypeRestriction ();
			type.Content = r;
			string ns = primitive.NamespaceURI;
			// Remap XML Schema datatypes namespace -> XML Schema namespace.
			if (ns == "http://www.w3.org/2001/XMLSchema-datatypes")
				ns = XSchema.Namespace;
			r.BaseTypeName = new XmlQualifiedName (primitive.Name, ns);
			foreach (RelaxngParam p in parameters) {
				XmlSchemaFacet f = null;
				string value = p.Value;
				switch (p.Name) {
				case "maxExclusive":
					f = new XmlSchemaMaxExclusiveFacet ();
					break;
				case "maxInclusive":
					f = new XmlSchemaMaxInclusiveFacet ();
					break;
				case "minExclusive":
					f = new XmlSchemaMinExclusiveFacet ();
					break;
				case "minInclusive":
					f = new XmlSchemaMinInclusiveFacet ();
					break;
				case "pattern":
					f = new XmlSchemaPatternFacet ();
					// .NET/Mono Regex has a bug that it does not support "IsLatin-1Supplement"
					// (it somehow breaks at '-').
					value = value.Replace ("\\p{IsLatin-1Supplement}", "[\\x80-\\xFF]");
					break;
				case "whiteSpace":
					f = new XmlSchemaWhiteSpaceFacet ();
					break;
				case "length":
					f = new XmlSchemaLengthFacet ();
					break;
				case "maxLength":
					f = new XmlSchemaMaxLengthFacet ();
					break;
				case "minLength":
					f = new XmlSchemaMinLengthFacet ();
					break;
				case "fractionDigits":
					f = new XmlSchemaFractionDigitsFacet ();
					break;
				case "totalDigits":
					f = new XmlSchemaTotalDigitsFacet ();
					break;
				default:
					throw new RelaxngException (String.Format ("XML Schema facet {0} is not recognized or not supported.", p.Name));
				}
				f.Value = value;
				r.Facets.Add (f);
			}

			// Now we create XmlSchema to handle simple-type
			// based validation (since there is no other way, 
			// because of sucky XmlSchemaSimpleType design).
			schema = new XSchema ();
			XmlSchemaElement el = new XmlSchemaElement ();
			el.Name = "root";
			el.SchemaType = type;
			schema.Items.Add (el);
			schema.Compile (null);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:68,代码来源:XsdDatatypeProvider.cs

示例14: Generate

        /// <summary>
        /// Generates strongly typed serialization classes for the given schema document
        /// under the given namespace and generates a code compile unit.
        /// </summary>
        /// <param name="xmlSchema">Schema document to generate classes for.</param>
        /// <param name="generateNamespace">Namespace to be used for the generated code.</param>
        /// <param name="commonNamespace">Namespace in which to find common classes and interfaces, 
        /// like ISchemaElement.</param>
        /// <returns>A fully populated CodeCompileUnit, which can be serialized in the language of choice.</returns>
        public static CodeCompileUnit Generate(XmlSchema xmlSchema, string generateNamespace, string commonNamespace)
        {
            if (xmlSchema == null)
            {
                throw new ArgumentNullException("xmlSchema");
            }
            if (generateNamespace == null)
            {
                throw new ArgumentNullException("generateNamespace");
            }

            simpleTypeNamesToClrTypeNames = new Hashtable();
            typeNamesToEnumDeclarations = new Dictionary<string,EnumDeclaration>();
            refToAttributeGroups = new Dictionary<string, XmlSchemaAttributeGroup>();
            enumsToParseMethodClasses = new Dictionary<EnumDeclaration, CodeTypeDeclaration>();

            CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
            CodeNamespace codeNamespace = new CodeNamespace(generateNamespace);
            codeCompileUnit.Namespaces.Add(codeNamespace);
            codeNamespace.Imports.Add(new CodeNamespaceImport("System"));
            codeNamespace.Imports.Add(new CodeNamespaceImport("System.CodeDom.Compiler")); // for GeneratedCodeAttribute
            codeNamespace.Imports.Add(new CodeNamespaceImport("System.Collections"));
            codeNamespace.Imports.Add(new CodeNamespaceImport("System.Diagnostics.CodeAnalysis"));
            codeNamespace.Imports.Add(new CodeNamespaceImport("System.Globalization"));
            codeNamespace.Imports.Add(new CodeNamespaceImport("System.Xml"));
            if (commonNamespace != null)
            {
                codeNamespace.Imports.Add(new CodeNamespaceImport(commonNamespace));
            }

            // NOTE: This hash table serves double duty so be sure to have the XSD
            //       type name mapped to the CLR type name *and* the CLR type name
            //       mapped to the same CLR type name.  Look at long and bool for
            //       examples below (and before you ask, no I don't know why DateTime
            //       just works).
            simpleTypeNamesToClrTypeNames.Add("dateTime", "DateTime");
            simpleTypeNamesToClrTypeNames.Add("integer", "int");
            simpleTypeNamesToClrTypeNames.Add("int", "int");
            simpleTypeNamesToClrTypeNames.Add("NMTOKEN", "string");
            simpleTypeNamesToClrTypeNames.Add("string", "string");
            simpleTypeNamesToClrTypeNames.Add("nonNegativeInteger", "long");
            simpleTypeNamesToClrTypeNames.Add("long", "long");
            simpleTypeNamesToClrTypeNames.Add("boolean", "bool");
            simpleTypeNamesToClrTypeNames.Add("bool", "bool");

            xmlSchema.Compile(null);

            foreach (XmlSchemaAttributeGroup schemaAttributeGroup in xmlSchema.AttributeGroups.Values)
            {
                refToAttributeGroups.Add(schemaAttributeGroup.Name, schemaAttributeGroup);
            }

            foreach (XmlSchemaObject schemaObject in xmlSchema.SchemaTypes.Values)
            {
                XmlSchemaSimpleType schemaSimpleType = schemaObject as XmlSchemaSimpleType;
                if (schemaSimpleType != null)
                {
                    ProcessSimpleType(schemaSimpleType, codeNamespace);
                }
            }

            foreach (XmlSchemaObject schemaObject in xmlSchema.SchemaTypes.Values)
            {
                XmlSchemaComplexType schemaComplexType = schemaObject as XmlSchemaComplexType;
                if (schemaComplexType != null)
                {
                    ProcessComplexType(schemaComplexType, codeNamespace);
                }
            }

            foreach (XmlSchemaObject schemaObject in xmlSchema.Elements.Values)
            {
                XmlSchemaElement schemaElement = schemaObject as XmlSchemaElement;
                if (schemaElement != null)
                {
                    ProcessElement(schemaElement, codeNamespace);
                }
            }

            return codeCompileUnit;
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:90,代码来源:StronglyTypedClasses.cs

示例15: Execute

        /// <summary>
        /// Executes the code generator.  Called from either the command line exe or the VS.NET wizard.  Only public function.
        /// </summary>
        /// <param name="xsdFile">Path to the XSD file stored on disk</param>
        /// <param name="language">Language for generated code</param>
        /// <param name="genNamespace">.NET namespace containing the generated types</param>
        /// <param name="fileName">File to be generated.  If null, namespace name is used</param>
        /// <param name="outputLocation">Location for the generated output file</param>
        /// <param name="constructRequiredSchema">Build a schema compliancy function -- MakeSchemaCompliant -- into each class</param>
        /// <param name="depthFirstTraversalHooks">Add DepthFirstTraversal hooks to fire custom DepthFirstTraversal events on each generated class</param>
        /// <param name="defaultInitialization">Set schema default values in class constructors</param>
        /// <param name="separateImportedNamespaces">Searate out imported namespaces into their own source files.  Default is all types in one file.</param>
        /// <param name="namespaceTable">Namespace map table.  Null if no imported namespaces exist</param>
        /// <param name="filenameTable">Filenames matching the namespaceTable.  Null if no imported namespaces exist -- and optional.</param>
        /// <param name="partialKeyword">put the .NET 2.0 partial keyword on every class</param>
        /// <param name="optionEElements"></param>
        /// <param name="acordLookupCodesFile">ACORD lookup codes file -- public</param>
        /// <param name="acordLookupCodesFilePrivate">ACORD lookup codes file -- private</param>
        /// <returns>result string</returns>
        public string[] Execute(string xsdFile, Language language, string genNamespace, string fileName,
            string outputLocation, bool constructRequiredSchema, bool depthFirstTraversalHooks, bool defaultInitialization,
            ref Hashtable namespaceTable, Hashtable filenameTable, bool partialKeyword, List<string> optionEElements, string acordLookupCodesFile, string acordLookupCodesFilePrivate)
        {
            FileStream schemaFile = null;

            try
            {
                schemaFile = new FileStream(xsdFile, FileMode.Open, FileAccess.Read);
                if (schemaFile == null) throw new XSDObjectGenException("Could not open the XSD schema file: " + xsdFile);

                schema = XmlSchema.Read(schemaFile, new ValidationEventHandler(ShowCompileError));
                schema.Compile(new ValidationEventHandler(ShowCompileError));

                elementFormDefault = schema.ElementFormDefault;
                attributeFormDefault = schema.AttributeFormDefault;

                if (language == Language.VB)
                {
                    code = (LanguageBase)new VBTemplate();
                }
                else if (language == Language.CS)
                {
                    code = (LanguageBase)new CSharpTemplate();
                }
                else
                {
                    throw new XSDObjectGenException(string.Format("Language {0} not supported.", language.ToString()));
                }

                if (!string.IsNullOrEmpty(acordLookupCodesFile))
                {
                    acordLookup = new XmlDocument();
                    try
                    {
                        acordLookup.Load(acordLookupCodesFile);
                    }
                    catch (Exception)
                    {
                        throw new XSDObjectGenException("Bad ACORD lookup file path or file");
                    }
                }

                if (!string.IsNullOrEmpty(acordLookupCodesFilePrivate))
                {
                    acordLookupPrivate = new XmlDocument();
                    try
                    {
                        acordLookupPrivate.Load(acordLookupCodesFilePrivate);
                    }
                    catch (Exception)
                    {
                        throw new XSDObjectGenException("Bad ACORD private codes lookup file path or file");
                    }
                }

                optionDefaultInitialization = defaultInitialization;
                optionConstructRequiredSchema = constructRequiredSchema;
                optionDepthFirstTraversalHooks = depthFirstTraversalHooks;
                LanguageBase.partialClasses = partialKeyword;
                globalComplexTypeClasses = new Hashtable();
                globalQualifiedComplexTypeClasses = new Hashtable();
                globalQualifiedAbstractTypeClasses = new Hashtable();
                enumerations = new Hashtable();
                enumerableClasses = new Hashtable();
                classesReferencingAbstractTypes = new Hashtable();
                ArrayList parentClassStack = new ArrayList();  // arraylist to collect a stack of parent owner .NET classes for  nested complexTypes 
                Globals.globalSchemaTypeTable.Clear();			// clear globals schema type table as it's a global object created at assembly load scope
                Globals.globalSeparateImportedNamespaces = false;   // means we have imported namespace and will have multiple source files
                Globals.globalClrNamespaceList.Clear();

                // Get list of all imported schemas -- to be used only if separateImportedNamespaces = true
                // Add the main xsd namespace.  If separateImportedNamespaces is false, there will be only
                //    one .net file generated with all of the types from all the xsd namespaces.  Otherwise multiple files. 
                //    First namespace in the list is the namespace for the base leaf schema -- for which code is being generated.
                ArrayList references = new ArrayList();
                if (namespaceTable != null)
                {
                    if (schema.TargetNamespace != null)
                        genNamespace = (string)namespaceTable[schema.TargetNamespace];  // in case it was changed while changing imported ns names
                    else
//.........这里部分代码省略.........
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:101,代码来源:XSDSchemaParser.cs


注:本文中的System.Xml.Schema.XmlSchema.Compile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。