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


C# Schema.XmlSchemaObject类代码示例

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


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

示例1: AddToTable

		public static void AddToTable (XmlSchemaObjectTable table, XmlSchemaObject obj,
			XmlQualifiedName qname, ValidationEventHandler h)
		{
			if (table.Contains (qname)) {
				// FIXME: This logic unexpectedly allows 
				// one redefining item and two or more redefining items.
				// FIXME: redefining item is not simple replacement,
				// but much more complex stuff.
				if (obj.isRedefineChild) {	// take precedence.
					if (obj.redefinedObject != null)
						obj.error (h, String.Format ("Named item {0} was already contained in the schema object table.", qname));
					else
						obj.redefinedObject = table [qname];
					table.Set (qname, obj);
				}
				else if (table [qname].isRedefineChild) {
					if (table [qname].redefinedObject != null)
						obj.error (h, String.Format ("Named item {0} was already contained in the schema object table.", qname));
					else
						table [qname].redefinedObject = obj;
					return;	// never add to the table.
				}
				else if (StrictMsCompliant) {
					table.Set (qname, obj);
				}
				else
					obj.error (h, String.Format ("Named item {0} was already contained in the schema object table. {1}",
					                             qname, "Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation."));
			}
			else
				table.Set (qname, obj);
		}
开发者ID:carrie901,项目名称:mono,代码行数:32,代码来源:XmlSchemaUtil.cs

示例2: AddItem

 internal XmlSchemaObject AddItem(XmlSchemaObject item, XmlQualifiedName qname, XmlSchemas schemas)
 {
     if (item == null)
     {
         return null;
     }
     if ((qname == null) || qname.IsEmpty)
     {
         return null;
     }
     string str = item.GetType().Name + ":" + qname.ToString();
     ArrayList list = (ArrayList) this.ObjectCache[str];
     if (list == null)
     {
         list = new ArrayList();
         this.ObjectCache[str] = list;
     }
     for (int i = 0; i < list.Count; i++)
     {
         XmlSchemaObject obj2 = (XmlSchemaObject) list[i];
         if (obj2 == item)
         {
             return obj2;
         }
         if (this.Match(obj2, item, true))
         {
             return obj2;
         }
         this.Warnings.Add(Res.GetString("XmlMismatchSchemaObjects", new object[] { item.GetType().Name, qname.Name, qname.Namespace }));
         this.Warnings.Add("DEBUG:Cached item key:\r\n" + ((string) this.looks[obj2]) + "\r\nnew item key:\r\n" + ((string) this.looks[item]));
     }
     list.Add(item);
     return item;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:SchemaObjectCache.cs

示例3: AddSymbol

        protected SymbolEntry AddSymbol(
            XmlQualifiedName qname, XmlSchemaObject schemaObject, string suffix)
        {
            SymbolEntry symbol = new SymbolEntry();
            symbol.xsdNamespace = qname.Namespace;
            symbol.clrNamespace = configSettings.GetClrNamespace(qname.Namespace);
            symbol.symbolName = qname.Name;
            string identifierName = NameGenerator.MakeValidIdentifier(
                symbol.symbolName, this.configSettings.NameMangler2);
            symbol.identifierName = identifierName;
            int id = 0;
            if(symbols.ContainsKey(symbol))
            {
                identifierName = identifierName + suffix;
                symbol.identifierName = identifierName;
                while (symbols.ContainsKey(symbol))
                {
                    id++;
                    symbol.identifierName = identifierName + id.ToString(CultureInfo.InvariantCulture.NumberFormat);
                }
            }
            if(symbol.isNameFixed())
                nFixedNames++;

            symbols.Add(symbol, symbol);
            schemaNameToIdentifiers.Add(schemaObject, symbol.identifierName); //Type vs typeName
            return symbol;
        }
开发者ID:dipdapdop,项目名称:linqtoxsd,代码行数:28,代码来源:NameMangler.cs

示例4: ImportSchemaType

		public override string ImportSchemaType(XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider) {
			if (type == null) {
				return null;
			}

			if (importedTypes[type] != null) {
				mainNamespace.Imports.Add(new CodeNamespaceImport(typeof(DataSet).Namespace));
				compileUnit.ReferencedAssemblies.Add("System.Data.dll");
				return (string)importedTypes[type];
			}
			if (!(context is XmlSchemaElement))
				return null;

			if (type is XmlSchemaComplexType) {
				XmlSchemaComplexType ct = (XmlSchemaComplexType)type;
				if (ct.Particle is XmlSchemaSequence) {
					XmlSchemaObjectCollection items = ((XmlSchemaSequence)ct.Particle).Items;
					if (items.Count == 2 && items[0] is XmlSchemaAny && items[1] is XmlSchemaAny) {
						XmlSchemaAny any0 = (XmlSchemaAny)items[0];
						XmlSchemaAny any1 = (XmlSchemaAny)items[1];
						if (any0.Namespace == XmlSchema.Namespace && any1.Namespace == "urn:schemas-microsoft-com:xml-diffgram-v1") {
							string typeName = typeof(DataTable).FullName;
							importedTypes.Add(type, typeName);
							mainNamespace.Imports.Add(new CodeNamespaceImport(typeof(DataTable).Namespace));
							compileUnit.ReferencedAssemblies.Add("System.Data.dll");
							return typeName;
						}
					}
				}
			}
			return null;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:32,代码来源:DataTableSchemaImporterExtension.cs

示例5: AddRef

 internal void AddRef(ArrayList list, XmlSchemaObject o)
 {
     if (((((o != null) && !this.schemas.IsReference(o)) && (o.Parent is XmlSchema)) && (((XmlSchema) o.Parent).TargetNamespace != "http://www.w3.org/2001/XMLSchema")) && !list.Contains(o))
     {
         list.Add(o);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SchemaGraph.cs

示例6: Read

        protected internal override void Read(XmlSchemaObject obj)
        {
            var type = (XmlSchemaComplexType) obj;

            if (type.Particle == null)
            {
                throw new InvalidOperationException(string.Format("Missing particle on choice type '{0}'", type.Name));
            }

            var choice = type.Particle as XmlSchemaChoice;

            if (choice == null)
            {
                throw new InvalidOperationException(string.Format("Unexpected particle type '{0}' on choice type '{1}'", type.Particle.GetType(), type.Name));
            }

            MaxOccurs = !string.IsNullOrEmpty(choice.MaxOccursString) ? choice.MaxOccurs : (decimal?) null;

            foreach (var item in choice.Items)
            {
                var element = item as XmlSchemaElement;

                if (element == null)
                {
                    throw new InvalidOperationException(string.Format("Unexpected item type '{0}' on choice type '{1}'", item.GetType(), type.Name));
                }

                var choiceType = new SDataSchemaChoiceItem();
                choiceType.Read(element);
                Types.Add(choiceType);
            }

            base.Read(obj);
        }
开发者ID:jasonhuber,项目名称:SDataUpdateNestedEntities,代码行数:34,代码来源:SDataSchemaChoiceType.cs

示例7: SetParent

		internal override void SetParent (XmlSchemaObject parent)
		{
			base.SetParent (parent);

			foreach (XmlSchemaObject obj in Items)
				obj.SetParent (this);
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:XmlSchemaAll.cs

示例8: ImportSchemaType

        public override string ImportSchemaType(
            string name,
            string ns,
            XmlSchemaObject context,
            XmlSchemas schemas,
            XmlSchemaImporter importer,
            CodeCompileUnit compileUnit,
            CodeNamespace mainNamespace,
            CodeGenerationOptions options,
            CodeDomProvider codeProvider)
        {
            if (ns != "http://www.w3.org/2001/XMLSchema")
                return null;

            switch (name)
            {
                case "anyURI":     return "System.Uri"; 
                case "gDay":       return "System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay";
                case "gMonth":     return "System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth";
                case "gMonthDay":  return "System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay";
                case "gYear":      return "System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear"; 
                case "gYearMonth": return "System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth";
                case "duration":   return "System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration"; 
                default: return null;
            }
        }
开发者ID:nujmail,项目名称:xsd-to-classes,代码行数:26,代码来源:SoapTypeExtension.cs

示例9: 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);
        //}

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

            XmlSchemaAnnotated annotatedType  = type as XmlSchemaAnnotated;
            if (annotatedType == null)
                return null;

            if (annotatedType.Annotation == null)
                return null;

            // create the comments and add them to the hash table under the namespace of the object
            CreateComments(annotatedType);

            //mainNamespace.Types.

            return null;

        }
开发者ID:nujmail,项目名称:xsd-to-classes,代码行数:50,代码来源:AnnotationTypeExtension.cs

示例10: AddSchemaItem

 private void AddSchemaItem(XmlSchemaObject item, string ns, string referencingNs)
 {
     XmlSchema schema = this.schemas[ns];
     if (schema == null)
     {
         schema = this.AddSchema(ns);
     }
     if (item is XmlSchemaElement)
     {
         XmlSchemaElement element = (XmlSchemaElement) item;
         if (element.Form == XmlSchemaForm.Unqualified)
         {
             throw new InvalidOperationException(Res.GetString("XmlIllegalForm", new object[] { element.Name }));
         }
         element.Form = XmlSchemaForm.None;
     }
     else if (item is XmlSchemaAttribute)
     {
         XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
         if (attribute.Form == XmlSchemaForm.Unqualified)
         {
             throw new InvalidOperationException(Res.GetString("XmlIllegalForm", new object[] { attribute.Name }));
         }
         attribute.Form = XmlSchemaForm.None;
     }
     schema.Items.Add(item);
     this.AddSchemaImport(ns, referencingNs);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:XmlSchemaExporter.cs

示例11: GetObjectDocumentationInfo

        public DocumentationInfo GetObjectDocumentationInfo(XmlSchemaObject obj)
        {
            var documentationInfo = InternalGetDocumentationInfo(obj);
            if (documentationInfo != null)
                return documentationInfo;

            XmlSchemaElement element;
            if (Casting.TryCast(obj, out element))
            {
                if (!element.RefName.IsEmpty)
                    return GetObjectDocumentationInfo(Context.SchemaSetManager.SchemaSet.GlobalElements[element.RefName]);

                if (element.ElementSchemaType != null && Context.Configuration.UseTypeDocumentationForUndocumentedElements)
                    return GetObjectDocumentationInfo(element.ElementSchemaType);
            }

            XmlSchemaAttribute attribute;
            if (Casting.TryCast(obj, out attribute))
            {
                if (!attribute.RefName.IsEmpty)
                    return GetObjectDocumentationInfo(Context.SchemaSetManager.SchemaSet.GlobalAttributes[attribute.RefName]);

                if (attribute.AttributeSchemaType != null && Context.Configuration.UseTypeDocumentationForUndocumentedAttributes)
                    return GetObjectDocumentationInfo(attribute.AttributeSchemaType);
            }

            return null;
        }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:28,代码来源:DocumentationManager.cs

示例12: Read

 protected internal override void Read(XmlSchemaObject obj)
 {
     var element = (XmlSchemaElement) obj;
     ElementName = element.Name;
     Type = element.SchemaTypeName;
     base.Read(obj);
 }
开发者ID:jasonhuber,项目名称:JobService_Jobs_Consumers,代码行数:7,代码来源:SDataSchemaChoiceItem.cs

示例13: GetName

        private static string GetName(XmlSchemaObject xmlSchemaObject)
        {
            var isGlobal = xmlSchemaObject.Parent is XmlSchema;

            var soAsAttribute = xmlSchemaObject as XmlSchemaAttribute;
            if (soAsAttribute != null)
                if (isGlobal)
                    return soAsAttribute.QualifiedName.Name;
                else
                    return "@" + soAsAttribute.QualifiedName.Name;

            var soAsElement = xmlSchemaObject as XmlSchemaElement;
            if (soAsElement != null)
                return soAsElement.QualifiedName.Name;

            var soAsGroup = xmlSchemaObject as XmlSchemaGroup;
            if (soAsGroup != null)
                return soAsGroup.QualifiedName.Name;

            var soAsAttributeGroup = xmlSchemaObject as XmlSchemaAttributeGroup;
            if (soAsAttributeGroup != null)
                return soAsAttributeGroup.QualifiedName.Name;

            var soAsComplexType = xmlSchemaObject as XmlSchemaComplexType;
            if (soAsComplexType != null && !soAsComplexType.QualifiedName.IsEmpty)
                return soAsComplexType.QualifiedName.Name;

            return null;
        }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:29,代码来源:XmlSchemaHelpKeywordExtensions.cs

示例14: GetHelpKeyword

        private static string GetHelpKeyword(XmlSchemaSet schemaSet, string xmlNamespace, XmlSchemaObject xmlSchemaObject)
        {
            var xmlLastObject = xmlSchemaObject;
            var sb = new StringBuilder();
            while (xmlSchemaObject != null && !(xmlSchemaObject is XmlSchema))
            {
                xmlSchemaObject = ResolveLink(schemaSet, xmlSchemaObject);
                var name = GetName(xmlSchemaObject);
                if (name != null)
                {
                    if (sb.Length > 0)
                        sb.Insert(0, "/");
                    sb.Insert(0, name);
                }

                xmlLastObject = xmlSchemaObject;
                xmlSchemaObject = xmlSchemaObject.Parent;
            }

            if (xmlLastObject is XmlSchemaGroup)
                sb.Insert(0, "#G/");
            else if (xmlLastObject is XmlSchemaAttributeGroup)
                sb.Insert(0, "#AG/");
            else if (xmlLastObject is XmlSchemaSimpleType || xmlLastObject is XmlSchemaComplexType)
                sb.Insert(0, "#T/");
            else
                sb.Insert(0, "#E/");

            sb.Insert(0, xmlNamespace ?? String.Empty);
            return sb.ToString();
        }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:31,代码来源:XmlSchemaHelpKeywordExtensions.cs

示例15: GetSourceCodeAbridged

 public string GetSourceCodeAbridged(XmlSchemaObject obj)
 {
     return InternalGetSourceCode(obj, PostProcessingOptions.RemoveAnnotations |
                                       PostProcessingOptions.CollapseElements |
                                       PostProcessingOptions.CollapseAttributes |
                                       PostProcessingOptions.Format);
 }
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:7,代码来源:SourceCodeManager.cs


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