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


C# XmlSchemas.Find方法代码示例

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


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

示例1: Bug360541

		public void Bug360541 ()
		{
			XmlSchemaComplexType stype = GetStype ();
			
			XmlSchemaElement selem1 = new XmlSchemaElement ();
			selem1.Name = "schema";
			selem1.SchemaType = stype;

			XmlSchema schema = new XmlSchema ();
			schema.Items.Add (selem1);

			XmlSchemas xs = new XmlSchemas ();
			xs.Add (schema);

			xs.Find (XmlQualifiedName.Empty, typeof (XmlSchemaElement));

			selem1 = new XmlSchemaElement ();
			selem1.Name = "schema1";
			selem1.SchemaType = stype;

			schema = new XmlSchema ();
			schema.Items.Add (selem1);

			xs = new XmlSchemas ();
			xs.Add (schema);
			xs.Find (XmlQualifiedName.Empty, typeof (XmlSchemaElement));
		}
开发者ID:nobled,项目名称:mono,代码行数:27,代码来源:XmlSchemasTests.cs

示例2: FindDataSetElement

 internal XmlSchemaElement FindDataSetElement(XmlSchema schema, XmlSchemas schemas)
 {
     foreach (XmlSchemaObject obj2 in schema.Items)
     {
         if ((obj2 is XmlSchemaElement) && IsDataSet((XmlSchemaElement) obj2))
         {
             XmlSchemaElement element = (XmlSchemaElement) obj2;
             return (XmlSchemaElement) schemas.Find(element.QualifiedName, typeof(XmlSchemaElement));
         }
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:TypedDataSetSchemaImporterExtension.cs

示例3: ImportSchemaType

        public override string ImportSchemaType(
            string name, 
            string ns, 
            XmlSchemaObject context, 
            XmlSchemas schemas, 
            XmlSchemaImporter importer,
            CodeCompileUnit compileUnit, 
            CodeNamespace mainNamespace, 
            CodeGenerationOptions options, 
            CodeDomProvider codeProvider)
        {

            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) schemas.Find(new XmlQualifiedName(name, ns), typeof(XmlSchemaSimpleType));
            return ImportSchemaType(
                simpleType, 
                context, 
                schemas, 
                importer, 
                compileUnit, 
                mainNamespace, 
                options, 
                codeProvider);
        }
开发者ID:nujmail,项目名称:xsd-to-classes,代码行数:23,代码来源:SimpleTypeExtension.cs

示例4: Import

        private ServiceDescriptionImportWarnings Import(CodeNamespace codeNamespace, ImportContext importContext, Hashtable exportContext, StringCollection warnings) {
            allSchemas = new XmlSchemas();
            foreach (XmlSchema schema in schemas) {
                allSchemas.Add(schema);
            }
            foreach (ServiceDescription description in serviceDescriptions) {
                foreach (XmlSchema schema in description.Types.Schemas) {
                    allSchemas.Add(schema);
                }
            }
            Hashtable references = new Hashtable();
            if (!allSchemas.Contains(ServiceDescription.Namespace)) {
                allSchemas.AddReference(ServiceDescription.Schema);
                references[ServiceDescription.Schema] = ServiceDescription.Schema;
            }
            if (!allSchemas.Contains(Soap.Encoding)) { 
                allSchemas.AddReference(ServiceDescription.SoapEncodingSchema);
                references[ServiceDescription.SoapEncodingSchema] = ServiceDescription.SoapEncodingSchema;
            }
            allSchemas.Compile(null, false);

            // Segregate the schemas containing abstract types from those 
            // containing regular XML definitions.  This is important because
            // when you import something returning the ur-type (object), then
            // you need to import ALL types/elements within ALL schemas.  We
            // don't want the RPC-based types leaking over into the XML-based
            // element definitions.  This also occurs when you have derivation:
            // we need to search the schemas for derived types: but WHICH schemas
            // should we search.
            foreach (ServiceDescription description in serviceDescriptions) {
                foreach (Message message in description.Messages) {
                    foreach (MessagePart part in message.Parts) {
                        bool isEncoded;
                        bool isLiteral;
                        FindUse(part, out isEncoded, out isLiteral);
                        if (part.Element != null && !part.Element.IsEmpty) {
                            if (isEncoded) throw new InvalidOperationException(Res.GetString(Res.CanTSpecifyElementOnEncodedMessagePartsPart, part.Name, message.Name));
                            XmlSchemaElement element = (XmlSchemaElement)allSchemas.Find(part.Element, typeof(XmlSchemaElement));
                            if (element != null) {
                                AddSchema(element.Parent as XmlSchema, isEncoded, isLiteral, abstractSchemas, concreteSchemas, references);
                                if (element.SchemaTypeName != null && !element.SchemaTypeName.IsEmpty) {
                                    XmlSchemaType type = (XmlSchemaType)allSchemas.Find(element.SchemaTypeName, typeof(XmlSchemaType));
                                    if (type != null) {
                                        AddSchema(type.Parent as XmlSchema, isEncoded, isLiteral, abstractSchemas, concreteSchemas, references);
                                    }
                                }
                            }
                        }
                        if (part.Type != null && !part.Type.IsEmpty) {
                            XmlSchemaType type = (XmlSchemaType)allSchemas.Find(part.Type, typeof(XmlSchemaType));
                            if (type != null) {
                                AddSchema(type.Parent as XmlSchema, isEncoded, isLiteral, abstractSchemas, concreteSchemas, references);
                            }
                        }
                    }
                }
            }

            Hashtable imports;
            foreach (XmlSchemas xmlschemas in new XmlSchemas[] { abstractSchemas, concreteSchemas }) {
                // collect all imports
                imports = new Hashtable();
                foreach (XmlSchema schema in xmlschemas) {
                    AddImport(schema, imports);
                }
                // make sure we add them to the corresponding schema collections
                foreach (XmlSchema schema in imports.Keys) {
                    if (references[schema] == null && !xmlschemas.Contains(schema)) {
                        xmlschemas.Add(schema);
                    }
                }
            }

            // If a schema was not referenced by either a literal or an encoded message part,
            // add it to both collections. There's no way to tell which it should be.
            imports = new Hashtable();
            foreach (XmlSchema schema in allSchemas) {
                if (!abstractSchemas.Contains(schema) && !concreteSchemas.Contains(schema)) {
                    AddImport(schema, imports);
                }
            }

            // make sure we add them to the corresponding schema collections
            foreach (XmlSchema schema in imports.Keys) {
                if (references[schema] != null)
                    continue;
                if (!abstractSchemas.Contains(schema)) {
                    abstractSchemas.Add(schema);
                }
                if (!concreteSchemas.Contains(schema)) {
                    concreteSchemas.Add(schema);
                }
            }
            if (abstractSchemas.Count > 0) {
                foreach (XmlSchema schema in references.Values) {
                    abstractSchemas.AddReference(schema);
                }
                StringCollection schemaWarnings = SchemaCompiler.Compile(abstractSchemas);
                foreach (string warning in schemaWarnings)
                    warnings.Add(warning);
//.........这里部分代码省略.........
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:101,代码来源:ServiceDescriptionImporter.cs


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