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


C# XmlSchemaElement.IsGlobal方法代碼示例

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


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

示例1: BuildProperty

        private ClrPropertyInfo BuildProperty(XmlSchemaElement elem, bool fromBaseType)
        {
            string identifierName = localSymbolTable.AddLocalElement(elem);

            XmlSchemaType schemaType = elem.ElementSchemaType;
            XmlQualifiedName schemaTypeName = schemaType.QualifiedName;
            string schemaName = elem.QualifiedName.Name;
            string schemaNs = elem.QualifiedName.Namespace;
            string clrNs =
                elem.FormResolved() == XmlSchemaForm.Qualified ?
                    configSettings.GetClrNamespace(schemaNs) : string.Empty;

            SchemaOrigin typeRefOrigin = SchemaOrigin.Fragment;
            bool isTypeRef = false;
            bool anonymousType = schemaTypeName.IsEmpty;
            XmlSchemaObject schemaObject = schemaType;

            ArrayList substitutionMembers = null;
            if (elem.IsGlobal())
            {
                substitutionMembers = IsSubstitutionGroupHead(elem);
                schemaTypeName = elem.QualifiedName;
                isTypeRef = true;
                typeRefOrigin = SchemaOrigin.Element;
                // For ref, get the element decl SOM object, as nameMappings are
                // keyed off the SOM object
                schemaObject = schemas.GlobalElements[schemaTypeName];
                anonymousType = false;
            }

            ClrTypeReference typeRef = BuildTypeReference(
                schemaObject, schemaTypeName, anonymousType, true);
            typeRef.Origin = typeRefOrigin;
            typeRef.IsTypeRef = isTypeRef;
            if (anonymousType && !fromBaseType)
            {
                //to fixup later.
                localSymbolTable.AddAnonymousType(identifierName, elem, typeRef);
            }
            ClrPropertyInfo propertyInfo =
                new ClrPropertyInfo(
                    identifierName, schemaNs, schemaName, GetOccurence(elem));
            propertyInfo.Origin = SchemaOrigin.Element;
            propertyInfo.FromBaseType = fromBaseType;
            propertyInfo.TypeReference = typeRef;

            //SetFixedDefaultValue(elem, propertyInfo);

            if (substitutionMembers != null)
            {
                propertyInfo.SubstitutionMembers = substitutionMembers;
            }
            //BuildAnnotationInformation(propertyInfo, elem);
            return propertyInfo;
            //Place it in the element's namespace, maybe element's parent type's namespace?
        }
開發者ID:dipdapdop,項目名稱:linqtoxsd,代碼行數:56,代碼來源:XsdToTypesConverter.cs


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