當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlSchemaObject.GetType方法代碼示例

本文整理匯總了C#中System.Xml.Schema.XmlSchemaObject.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchemaObject.GetType方法的具體用法?C# XmlSchemaObject.GetType怎麽用?C# XmlSchemaObject.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Schema.XmlSchemaObject的用法示例。


在下文中一共展示了XmlSchemaObject.GetType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: Create

		public XsdValidationState Create (XmlSchemaObject xsobj)
		{
			string typeName = xsobj.GetType ().Name;
			switch (typeName) {
			case "XmlSchemaElement":
				return AddElement ((XmlSchemaElement) xsobj);
			case "XmlSchemaSequence":
				return AddSequence ((XmlSchemaSequence) xsobj);
			case "XmlSchemaChoice":
				return AddChoice ((XmlSchemaChoice) xsobj);
			case "XmlSchemaAll":
				return AddAll ((XmlSchemaAll) xsobj);
			case "XmlSchemaAny":
				return AddAny ((XmlSchemaAny) xsobj);
			case "EmptyParticle":
				return AddEmpty ();
			default:
				// GroupRef should not appear
				throw new InvalidOperationException ("Should not occur.");
			}
		}
開發者ID:nobled,項目名稱:mono,代碼行數:21,代碼來源:XsdParticleValidationState.cs

示例3: AddSchemaItem

        /// <summary>
        /// Adds a schema item to the schema if the item is not a duplicate.
        /// </summary>
        /// <param name="schema">A Schema that the item may be added to.</param>
        /// <param name="item">A schema item to add.</param>
        /// <returns></returns>
        private bool AddSchemaItem(XmlSchema schema, XmlSchemaObject item)
        {
            bool conflictingTypes = false;
            bool isDuplicate = false;
            string itemName = null;
            if (item is XmlSchemaElement)
                itemName = ((XmlSchemaElement)item).Name;
            else if (item is XmlSchemaComplexType)
                itemName = ((XmlSchemaComplexType)item).Name;
            else if (item is XmlSchemaSimpleType)
                itemName = ((XmlSchemaSimpleType)item).Name;
            else
            {
                Logger.WriteLine("        Unsupported schema type " + item.GetType().ToString() + " detected.", LogLevel.Verbose);
                return false;
            }

            foreach (XmlSchemaObject obj in schema.Items)
            {
                if (obj is XmlSchemaElement)
                {
                    if (((XmlSchemaElement)obj).Name == itemName)
                    {
                        if (item is XmlSchemaElement)
                        {
                            XmlSchemaElement element = (XmlSchemaElement)item;
                            if (element.SchemaTypeName != ((XmlSchemaElement)obj).SchemaTypeName)
                                conflictingTypes = true;
                            isDuplicate = true;
                        }
                        else
                            conflictingTypes = true;    
                        break;
                    }
                }
                else if (obj is XmlSchemaSimpleType)
                {
                    if (((XmlSchemaSimpleType)obj).Name == itemName)
                    {
                        if (item is XmlSchemaSimpleType)
                            isDuplicate = true;
                        else
                            conflictingTypes = true;
                        break;
                    }
                }
                else if (obj is XmlSchemaComplexType)
                {
                    if (((XmlSchemaComplexType)obj).Name == itemName)
                    {
                        if (item is XmlSchemaComplexType)
                            isDuplicate = true;
                        else
                            conflictingTypes = true;
                        break;
                    }
                }
            }
            
            // If conflicting type names are detected throw
            if (conflictingTypes)
            {
                string errMsg = "\nException: Conflicting parameter \"" + itemName + "\" detected in schema " + schema.TargetNamespace + ".";
                      errMsg += "Multiple operation parameters with the same name that reference different types results in invalid schema.";
                      errMsg += "Change the name of this parameter in code.";
                throw new Exception(errMsg);
            }

            // If this is a new item add it to the schema
            if (!isDuplicate)
                    schema.Items.Add(item);
                else
                    Logger.WriteLine("        Duplicate parameter \"" + itemName + "\" detected in schema " + schema.TargetNamespace + ". Duplicate was discarded.", LogLevel.Normal);

            return isDuplicate;
        }
開發者ID:prabby,項目名稱:miniclr,代碼行數:82,代碼來源:MFMetadataExporter.cs

示例4: ErrorHandler

 static void ErrorHandler(XmlSchemaObject schemaObject, HelpExampleGeneratorContext context)
 {
     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.HelpExampleGeneratorSchemaObjectNotSupported, schemaObject.GetType().Name)));
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:4,代碼來源:HelpExampleGenerator.cs

示例5: InvokeHandler

 static void InvokeHandler(XmlSchemaObject schemaObject, HelpExampleGeneratorContext context)
 {
     if (++context.currentDepthLevel < MaxDepthLevel)
     {
         Action<XmlSchemaObject, HelpExampleGeneratorContext> action;
         Type objectType = schemaObject.GetType();
         if (context.objectHandler.TryGetValue(objectType, out action))
         {
             action(schemaObject, context);
         }
         else if (objectType.Name != "EmptyParticle")
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.HelpExampleGeneratorHandlerNotFound, schemaObject.GetType().Name)));
         }
         --context.currentDepthLevel;
     }
     else
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.HelpExampleGeneratorMaxDepthLevelReached, schemaObject.GetType().Name)));
     }
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:21,代碼來源:HelpExampleGenerator.cs

示例6: GetSchemaObjectType

 private static string GetSchemaObjectType(XmlSchemaObject extension)
 {
     const int xmlSchemaPrefixLength = 9; // == "XmlSchema".Length;
     return extension.GetType().Name.Substring(xmlSchemaPrefixLength);
 }
開發者ID:sergey-steinvil,項目名稱:xsddoc,代碼行數:5,代碼來源:ProblemReporter.cs

示例7: Depends

 internal void Depends(XmlSchemaObject item, ArrayList refs)
 {
     if ((item != null) && (this.scope[item] == null))
     {
         Type c = item.GetType();
         if (typeof(XmlSchemaType).IsAssignableFrom(c))
         {
             XmlQualifiedName empty = XmlQualifiedName.Empty;
             XmlSchemaType o = null;
             XmlSchemaParticle particle = null;
             XmlSchemaObjectCollection attributes = null;
             if (item is XmlSchemaComplexType)
             {
                 XmlSchemaComplexType type3 = (XmlSchemaComplexType) item;
                 if (type3.ContentModel != null)
                 {
                     XmlSchemaContent content = type3.ContentModel.Content;
                     if (content is XmlSchemaComplexContentRestriction)
                     {
                         empty = ((XmlSchemaComplexContentRestriction) content).BaseTypeName;
                         attributes = ((XmlSchemaComplexContentRestriction) content).Attributes;
                     }
                     else if (content is XmlSchemaSimpleContentRestriction)
                     {
                         XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content;
                         if (restriction.BaseType != null)
                         {
                             o = restriction.BaseType;
                         }
                         else
                         {
                             empty = restriction.BaseTypeName;
                         }
                         attributes = restriction.Attributes;
                     }
                     else if (content is XmlSchemaComplexContentExtension)
                     {
                         XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) content;
                         attributes = extension.Attributes;
                         particle = extension.Particle;
                         empty = extension.BaseTypeName;
                     }
                     else if (content is XmlSchemaSimpleContentExtension)
                     {
                         XmlSchemaSimpleContentExtension extension2 = (XmlSchemaSimpleContentExtension) content;
                         attributes = extension2.Attributes;
                         empty = extension2.BaseTypeName;
                     }
                 }
                 else
                 {
                     attributes = type3.Attributes;
                     particle = type3.Particle;
                 }
                 if (particle is XmlSchemaGroupRef)
                 {
                     XmlSchemaGroupRef ref2 = (XmlSchemaGroupRef) particle;
                     particle = ((XmlSchemaGroup) this.schemas.Find(ref2.RefName, typeof(XmlSchemaGroup), false)).Particle;
                 }
                 else if (particle is XmlSchemaGroupBase)
                 {
                     particle = (XmlSchemaGroupBase) particle;
                 }
             }
             else if (item is XmlSchemaSimpleType)
             {
                 XmlSchemaSimpleType type4 = (XmlSchemaSimpleType) item;
                 XmlSchemaSimpleTypeContent content2 = type4.Content;
                 if (content2 is XmlSchemaSimpleTypeRestriction)
                 {
                     o = ((XmlSchemaSimpleTypeRestriction) content2).BaseType;
                     empty = ((XmlSchemaSimpleTypeRestriction) content2).BaseTypeName;
                 }
                 else if (content2 is XmlSchemaSimpleTypeList)
                 {
                     XmlSchemaSimpleTypeList list = (XmlSchemaSimpleTypeList) content2;
                     if ((list.ItemTypeName != null) && !list.ItemTypeName.IsEmpty)
                     {
                         empty = list.ItemTypeName;
                     }
                     if (list.ItemType != null)
                     {
                         o = list.ItemType;
                     }
                 }
                 else if (content2 is XmlSchemaSimpleTypeRestriction)
                 {
                     empty = ((XmlSchemaSimpleTypeRestriction) content2).BaseTypeName;
                 }
                 else if (c == typeof(XmlSchemaSimpleTypeUnion))
                 {
                     XmlQualifiedName[] memberTypes = ((XmlSchemaSimpleTypeUnion) item).MemberTypes;
                     if (memberTypes != null)
                     {
                         for (int i = 0; i < memberTypes.Length; i++)
                         {
                             XmlSchemaType type5 = (XmlSchemaType) this.schemas.Find(memberTypes[i], typeof(XmlSchemaType), false);
                             this.AddRef(refs, type5);
                         }
                     }
//.........這裏部分代碼省略.........
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:101,代碼來源:SchemaGraph.cs

示例8: Match

        internal bool Match(XmlSchemaObject o1, XmlSchemaObject o2, bool shareTypes) {
            if (o1 == o2)
                return true;
            if (o1.GetType() != o2.GetType())
                return false;
            if (Hash[o1] == null)
                Hash[o1] = GetHash(o1);
            int hash1 = (int)Hash[o1];
            int hash2 = GetHash(o2);
            if (hash1 != hash2)
                return false;

            if (shareTypes)
                return CompositeHash(o1, hash1) == CompositeHash(o2, hash2);
            return true;
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:16,代碼來源:ImportContext.cs

示例9: ErrorHandler

 static void ErrorHandler(XmlSchemaObject schemaObject, HelpExampleGeneratorContext context)
 {
     throw new InvalidOperationException(String.Format("Schema object {0} not supported.", schemaObject.GetType().Name));
 }
開發者ID:rocketeerbkw,項目名稱:DNA,代碼行數:4,代碼來源:HelpExampleGenerator.cs

示例10: Match

 internal bool Match(XmlSchemaObject o1, XmlSchemaObject o2, bool shareTypes)
 {
     if (o1 != o2)
     {
         if (o1.GetType() != o2.GetType())
         {
             return false;
         }
         if (this.Hash[o1] == null)
         {
             this.Hash[o1] = this.GetHash(o1);
         }
         int hash = (int) this.Hash[o1];
         int num2 = this.GetHash(o2);
         if (hash != num2)
         {
             return false;
         }
         if (shareTypes)
         {
             return (this.CompositeHash(o1, hash) == this.CompositeHash(o2, num2));
         }
     }
     return true;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:25,代碼來源:SchemaObjectCache.cs

示例11: FillXsltArgumentList

        private void FillXsltArgumentList(XsltArgumentList argumentList, string prefix, XmlSchemaObject obj)
        {
            var topic = (obj == null) ? null : Context.TopicManager.GetTopic(obj);
            var itemType = (obj == null) ? string.Empty : obj.GetType().Name.Substring(9).ToLower();
            var itemNamespace = (obj == null) ? string.Empty : obj.GetSchema().TargetNamespace ?? string.Empty;
            var itemUri = (topic == null) ? string.Empty : topic.LinkUri;

            argumentList.AddParam(prefix + "ItemType", string.Empty, itemType);
            argumentList.AddParam(prefix + "ItemNamespace", string.Empty, itemNamespace);
            argumentList.AddParam(prefix + "ItemUri", string.Empty, itemUri);
        }
開發者ID:sergey-steinvil,項目名稱:xsddoc,代碼行數:11,代碼來源:DocumentationManager.cs

示例12: GetAllElements

        public static List<XmlSchemaElement> GetAllElements(XmlSchemaObject obj, bool recursive, List<XmlSchemaElement> allElements)
        {
            List<XmlSchemaElement> elements  = new List<XmlSchemaElement>();

            // Element
            if (obj.GetType().Equals(typeof(XmlSchemaElement)))
            {
                XmlSchemaElement element  = (XmlSchemaElement)obj;

                XmlSchemaComplexType complexType = element.ElementSchemaType as XmlSchemaComplexType;

                if (complexType != null)
                {
                    #region sequence
                    /// Get the sequence particle of the complex type.
                    XmlSchemaSequence sequence = complexType.ContentTypeParticle as XmlSchemaSequence;
                    if (sequence != null)
                    {
                        // Iterate over each XmlSchemaElement in the Items collection.
                        foreach (XmlSchemaObject childElement in sequence.Items)
                        {
                            elements = GetElements(childElement, elements, recursive, allElements);
                        }
                    }

                    #endregion

                    #region choice
                    // check if it is e choice
                    XmlSchemaChoice choice = complexType.ContentTypeParticle as XmlSchemaChoice;
                    if (choice != null)
                    {
                        // Iterate over each XmlSchemaElement in the Items collection.
                        foreach (XmlSchemaObject childElement in choice.Items)
                        {
                            elements = GetElements(childElement, elements, recursive, allElements);
                        }
                    }
                    #endregion
                }
            }

            if (obj.GetType().Equals(typeof(XmlSchemaComplexType)))
            {
                XmlSchemaComplexType complexType = obj as XmlSchemaComplexType;

                if (complexType != null)
                {
                    #region sequence
                    /// Get the sequence particle of the complex type.
                    XmlSchemaSequence sequence = complexType.ContentTypeParticle as XmlSchemaSequence;
                    if (sequence != null)
                    {
                        // Iterate over each XmlSchemaElement in the Items collection.
                        foreach (XmlSchemaObject childElement in sequence.Items)
                        {
                            elements = GetElements(childElement, elements, recursive, allElements);
                        }
                    }

                    #endregion

                    #region choice
                    // check if it is e choice
                    XmlSchemaChoice choice = complexType.ContentTypeParticle as XmlSchemaChoice;
                    if (choice != null)
                    {
                        // Iterate over each XmlSchemaElement in the Items collection.
                        foreach (XmlSchemaObject childElement in choice.Items)
                        {
                            elements = GetElements(childElement, elements, recursive, allElements);
                        }
                    }
                    #endregion
                }
            }

            if (obj is XmlSchemaGroup)
            {
                XmlSchemaGroup group = obj as XmlSchemaGroup;

              #region sequence
                    /// Get the sequence particle of the complex type.
                    XmlSchemaSequence sequence = group.Particle as XmlSchemaSequence;
                    if (sequence != null)
                    {
                        // Iterate over each XmlSchemaElement in the Items collection.
                        foreach (XmlSchemaObject childElement in sequence.Items)
                        {
                            elements = GetElements(childElement, elements, recursive, allElements);
                        }
                    }

              #endregion

                #region choice
                // check if it is e choice
                XmlSchemaChoice choice = group.Particle as XmlSchemaChoice;
                if (choice != null)
                {
//.........這裏部分代碼省略.........
開發者ID:BEXIS2,項目名稱:Core,代碼行數:101,代碼來源:XmlSchemaUtility.cs

示例13: GetElements

        private static List<XmlSchemaElement> GetElements(XmlSchemaObject element, List<XmlSchemaElement> list, bool recursive, List<XmlSchemaElement> allElements)
        {
            // Element
            if (element.GetType().Equals(typeof(XmlSchemaElement)))
            {
                XmlSchemaElement child = (XmlSchemaElement)element;

                if (child.Name != null)
                {
                    if (list.Where(e => e.Name.Equals(child.Name)).Count() == 0)
                    {
                        //if (!child.SchemaTypeName.Name.Equals(parentTypeName))
                        //{

                        list.Add(child);

                        if (recursive)
                        {

                            Debug.WriteLine("--<" + child.Name);

                            XmlSchemaComplexType complexType = child.ElementSchemaType as XmlSchemaComplexType;
                            if (complexType != null)
                            {
                                #region sequence

                                /// Get the sequence particle of the complex type.
                                XmlSchemaSequence sequence = complexType.ContentTypeParticle as XmlSchemaSequence;
                                if (sequence != null)
                                {
                                    // Iterate over each XmlSchemaElement in the Items collection.
                                    foreach (XmlSchemaObject childElement in sequence.Items)
                                    {
                                        list = GetElements(childElement, list, recursive, allElements);
                                    }
                                }

                                #endregion

                                #region choice

                                // check if it is e choice
                                XmlSchemaChoice choice = complexType.ContentTypeParticle as XmlSchemaChoice;
                                if (choice != null)
                                {
                                    // Iterate over each XmlSchemaElement in the Items collection.
                                    foreach (XmlSchemaObject childElement in choice.Items)
                                    {
                                        list = GetElements(childElement, list, recursive, allElements);
                                    }
                                }

                                #endregion
                            }
                        }

                        //}
                    }
                }
                else
                {
                    if (child.RefName != null)
                    {
                        XmlSchemaElement refElement = allElements.Where(e => e.QualifiedName.Equals(child.RefName)).FirstOrDefault();
                        if (refElement != null)
                        {
                            list.Add(refElement);

                            if (recursive)
                            {

                                Debug.WriteLine("--<" + refElement.Name);

                                XmlSchemaComplexType complexType = refElement.ElementSchemaType as XmlSchemaComplexType;
                                if (complexType != null)
                                {
                                    #region sequence
                                    /// Get the sequence particle of the complex type.
                                    XmlSchemaSequence sequence = complexType.ContentTypeParticle as XmlSchemaSequence;
                                    if (sequence != null)
                                    {
                                        // Iterate over each XmlSchemaElement in the Items collection.
                                        foreach (XmlSchemaObject childElement in sequence.Items)
                                        {
                                            list = GetElements(childElement, list, recursive, allElements);
                                        }
                                    }

                                    #endregion

                                    #region choice
                                    // check if it is e choice
                                    XmlSchemaChoice choice = complexType.ContentTypeParticle as XmlSchemaChoice;
                                    if (choice != null)
                                    {
                                        // Iterate over each XmlSchemaElement in the Items collection.
                                        foreach (XmlSchemaObject childElement in choice.Items)
                                        {
                                            list = GetElements(childElement, list, recursive, allElements);
                                        }
//.........這裏部分代碼省略.........
開發者ID:BEXIS2,項目名稱:Core,代碼行數:101,代碼來源:XmlSchemaUtility.cs

示例14: UnexpectedSchemaObjectType

 public static Exception UnexpectedSchemaObjectType(XmlSchemaObject schemaObject)
 {
     var message = string.Format(CultureInfo.CurrentCulture, Resources.ExceptionBuilderUnexpectedSchemaObjectType, schemaObject.GetType());
     return new NotImplementedException(message);
 }
開發者ID:sergey-steinvil,項目名稱:xsddoc,代碼行數:5,代碼來源:ExceptionBuilder.cs

示例15: Dispatch

        private void Dispatch(XmlSchemaObject o)
        {
            if (o == null)
                return;

            if (o is XmlSchemaSimpleType)
            {
                VisitSimpleType((XmlSchemaSimpleType)o);
            }
            else if (o is XmlSchemaComplexType)
            {
                VisitComplexType((XmlSchemaComplexType)o);
            }
            else if (o is XmlSchemaAttribute)
            {
                VisitXmlSchemaAttribute((XmlSchemaAttribute)o);
            }
            else if (o is XmlSchemaElement)
            {
                VisitXmlSchemaElement((XmlSchemaElement)o);
            }
            else if (o is XmlSchemaSimpleTypeRestriction)
            {
                VisitXmlSchemaSimpleTypeRestriction((XmlSchemaSimpleTypeRestriction)o);
            }
            else if (o is XmlSchemaAttributeGroup)
            {
                VisitXmlSchemaAttributeGroup((XmlSchemaAttributeGroup)o);
            }
            else if (o is XmlSchemaAttributeGroupRef)
            {
                VisitXmlSchemaAttributeGroupRef((XmlSchemaAttributeGroupRef)o);
            }
            else if (o is XmlSchemaSequence)
            {
                VisitXmlSchemaSequence((XmlSchemaSequence)o);
            }
            else if (o is XmlSchemaChoice)
            {
                VisitXmlSchemaChoice((XmlSchemaChoice)o);
            }
            else if (o is XmlSchemaGroup)
            {
                VisitXmlSchemaGroup((XmlSchemaGroup)o);
            }
            else if (o is XmlSchemaGroupRef)
            {
                VisitXmlSchemaGroupRef((XmlSchemaGroupRef)o);
            }
            else
                Assert.Fail("Unexpected " + o + " " + o.GetType());
        }
開發者ID:willrawls,項目名稱:arp,代碼行數:52,代碼來源:XsdVisitor.cs


注:本文中的System.Xml.Schema.XmlSchemaObject.GetType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。