• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# XmlSchemaForm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: XmlSchemaAttribute

		public XmlSchemaAttribute()
		{
			//LAMESPEC: Docs says the default is optional.
			//Whereas the MS implementation has default None.
			form	= XmlSchemaForm.None;
			use		= XmlSchemaUse.None;
			schemaTypeName	= XmlQualifiedName.Empty;
			qualifiedName	= XmlQualifiedName.Empty;
			refName			= XmlQualifiedName.Empty;
		}
开发者ID:nobled,项目名称:mono,代码行数:10,代码来源:XmlSchemaAttribute.cs


示例2: ClassAttributeFieldCode

        public virtual void ClassAttributeFieldCode(StreamWriter outStream, string dotNetDatatype, string xsdDatatype, string fieldName, string dotnetFieldName, XmlSchemaForm attributeFormDefault, bool isSchemaEnumerationType, string ns)
        {
            outStream.WriteLine();
            string str = fieldName;
            string str2 = ReplaceInvalidChars(dotnetFieldName);
            string str3 = this.CheckForKeywords(dotnetFieldName);
            string str4 = this.ConvertSystemDatatype(dotNetDatatype);
            string str5 = "";
            string str6 = "";
            if ((attributeFormDefault == XmlSchemaForm.Qualified) || (attributeFormDefault == XmlSchemaForm.Unqualified))
            {
                str6 = ",Form" + this.AttributeAssignmentOperator + "XmlSchemaForm." + attributeFormDefault.ToString();
                str5 = this.CalculateNamespace(this.schemaTargetNamespace, ns, dotNetDatatype == "System.Xml.XmlAttribute[]");
            }
            if (xsdDatatype == "anyType")
            {
                xsdDatatype = "";
            }
            else if (xsdDatatype != "")
            {
                xsdDatatype = ",DataType" + this.AttributeAssignmentOperator + "\"" + xsdDatatype + "\"";
            }
            switch (dotNetDatatype)
            {
                case "System.String":
                case "System.Byte[]":
                case "System.Object":
                case "System.Xml.XmlQualifiedName":
                    outStream.WriteLine(this.AttributeObjectTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    break;

                case "System.Xml.XmlAttribute[]":
                    outStream.WriteLine(this.AttributeAnyTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    break;

                case "System.DateTime":
                    outStream.WriteLine(this.AttributeDateTimeTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    break;

                default:
                    if (str4 == "string")
                    {
                        outStream.WriteLine(this.AttributeObjectTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    }
                    else
                    {
                        outStream.WriteLine(this.AttributeValueTypeTemplate, new object[] { str2, str4, str, str6, xsdDatatype, str3, str5, hiddenMemberPrefix });
                    }
                    break;
            }
        }
开发者ID:MartinBG,项目名称:Gva,代码行数:51,代码来源:LanguageBase.cs


示例3: XmlSchema

		public XmlSchema ()
		{
			attributeFormDefault= XmlSchemaForm.None;
			blockDefault = XmlSchemaDerivationMethod.None;
			elementFormDefault = XmlSchemaForm.None;
			finalDefault = XmlSchemaDerivationMethod.None;
			includes = new XmlSchemaObjectCollection();
			isCompiled = false;
			items = new XmlSchemaObjectCollection();
			attributeGroups = new XmlSchemaObjectTable();
			attributes = new XmlSchemaObjectTable();
			elements = new XmlSchemaObjectTable();
			groups = new XmlSchemaObjectTable();
			notations = new XmlSchemaObjectTable();
			schemaTypes = new XmlSchemaObjectTable();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:XmlSchema.cs


示例4: AssertElementEx

		public static void AssertElementEx (XmlSchemaElement element,
			XmlSchemaDerivationMethod block, XmlSchemaDerivationMethod final,
			string defaultValue, string fixedValue,
			XmlSchemaForm form, bool isAbstract, bool isNillable,
			XmlQualifiedName substGroup)
		{
			Assert.IsNotNull (element);
			Assert.AreEqual (block, element.Block);
			Assert.AreEqual (final, element.Final);
			Assert.AreEqual (defaultValue, element.DefaultValue);
			Assert.AreEqual (fixedValue, element.FixedValue);
			Assert.AreEqual (form, element.Form);
			Assert.AreEqual (isAbstract, element.IsAbstract);
			Assert.AreEqual (isNillable, element.IsNillable);
			Assert.AreEqual (substGroup, element.SubstitutionGroup);
		}
开发者ID:nobled,项目名称:mono,代码行数:16,代码来源:XmlSchemaAssertion.cs


示例5: XmlMemberMapping

		internal XmlMemberMapping (string memberName, string defaultNamespace, XmlTypeMapMember mapMem, bool encodedFormat)
		{
			_mapMember = mapMem;
			_memberName = memberName;

			if (mapMem is XmlTypeMapMemberAnyElement)
			{
				XmlTypeMapMemberAnyElement anyelem = (XmlTypeMapMemberAnyElement) mapMem;
				XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) anyelem.ElementInfo[anyelem.ElementInfo.Count-1];
				_elementName = info.ElementName;
				_namespace = info.Namespace;
				if (info.MappedType != null) _typeNamespace = info.MappedType.Namespace;
				else _typeNamespace = "";
			}
			else if (mapMem is XmlTypeMapMemberElement)
			{
				XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) ((XmlTypeMapMemberElement)mapMem).ElementInfo[0];
				_elementName = info.ElementName;
				if (encodedFormat)
				{
					_namespace = defaultNamespace;
					if (info.MappedType != null) _typeNamespace = "";
					else _typeNamespace = info.DataTypeNamespace;
				}
				else
				{
					_namespace = info.Namespace;
					if (info.MappedType != null) _typeNamespace = info.MappedType.Namespace;
					else _typeNamespace = "";
					_form = info.Form;
				}
			}
			else
			{
				_elementName = _memberName;
				_namespace = "";
			}
			
			if (_form == XmlSchemaForm.None) 
				_form = XmlSchemaForm.Qualified;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:41,代码来源:XmlMemberMapping.cs


示例6: CheckForm

 static void CheckForm(XmlSchemaForm form, bool isQualified) {
     if (isQualified && form == XmlSchemaForm.Unqualified) throw new InvalidOperationException(Res.GetString(Res.XmlInvalidFormUnqualified));
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:3,代码来源:xmlreflectionimporter.cs


示例7: ImportAccessorMapping

        void ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, string ns, XmlSchemaForm form, Type choiceIdentifierType) {
            int previousNestingLevel = arrayNestingLevel;
            XmlArrayItemAttributes previousArrayItemAttributes = savedArrayItemAttributes;
            string previousArrayNamespace = savedArrayNamespace;
            arrayNestingLevel = 0;
            savedArrayItemAttributes = null;
            savedArrayNamespace = null;
            Type accessorType = model.FieldType;
            string accessorName = model.Name;
            NameTable elements = new NameTable();
            accessor.TypeDesc = typeScope.GetTypeDesc(accessorType);
            XmlAttributeFlags flags = a.XmlFlags;
            accessor.Ignore = a.XmlIgnore;
            CheckAmbiguousChoice(a, accessorType, accessorName);

            XmlAttributeFlags elemFlags = XmlAttributeFlags.Elements | XmlAttributeFlags.Text | XmlAttributeFlags.AnyElements | XmlAttributeFlags.ChoiceIdentifier;
            XmlAttributeFlags attrFlags = XmlAttributeFlags.Attribute | XmlAttributeFlags.AnyAttribute;
            XmlAttributeFlags arrayFlags = XmlAttributeFlags.Array | XmlAttributeFlags.ArrayItems;

            // special case for byte[]. It can be a primitive (base64Binary or hexBinary), or it can
            // be an array of bytes. Our default is primitive; specify [XmlArray] to get array behavior.
            if ((flags & arrayFlags) != 0 && accessorType == typeof(byte[]))
                accessor.TypeDesc = typeScope.GetArrayTypeDesc(accessorType);


            if (a.XmlChoiceIdentifier != null) {
                accessor.ChoiceIdentifier = new ChoiceIdentifierAccessor();
                accessor.ChoiceIdentifier.MemberName = a.XmlChoiceIdentifier.MemberName;
                accessor.ChoiceIdentifier.Mapping = ImportTypeMapping(modelScope.GetTypeModel(choiceIdentifierType), ns, ImportContext.Element, String.Empty);
            }

            if (accessor.TypeDesc.IsArrayLike) {
                Type arrayElementType = TypeScope.GetArrayElementType(accessorType);

                if ((flags & attrFlags) != 0) {
                    if ((flags & attrFlags) != flags) 
                        throw new InvalidOperationException(Res.GetString(Res.XmlIllegalAttributesArrayAttribute));

                    if (a.XmlAttribute != null && !accessor.TypeDesc.ArrayElementTypeDesc.IsPrimitive && !accessor.TypeDesc.ArrayElementTypeDesc.IsEnum)
                        throw new InvalidOperationException(Res.GetString(Res.XmlIllegalAttrOrText, accessorName));

                    bool isList = a.XmlAttribute != null && (accessor.TypeDesc.ArrayElementTypeDesc.IsPrimitive || accessor.TypeDesc.ArrayElementTypeDesc.IsEnum);

                    if (a.XmlAnyAttribute != null) {
                        a.XmlAttribute = new XmlAttributeAttribute();
                    }

                    AttributeAccessor attribute = new AttributeAccessor();
                    Type targetType = a.XmlAttribute.Type == null ? arrayElementType : a.XmlAttribute.Type;
                    TypeDesc targetTypeDesc = typeScope.GetTypeDesc(targetType);
                    attribute.Name = Accessor.EscapeName(a.XmlAttribute.AttributeName.Length == 0 ? accessorName : a.XmlAttribute.AttributeName, true);
                    attribute.Namespace = a.XmlAttribute.Namespace == null ? ns : a.XmlAttribute.Namespace;
                    attribute.Form = a.XmlAttribute.Form;   // == XmlSchemaForm.None ? form : a.XmlAttribute.Form;
                    if (attribute.Form == XmlSchemaForm.None && ns != attribute.Namespace) {
                        attribute.Form = XmlSchemaForm.Qualified;
                    }
                    attribute.CheckSpecial();
                    CheckForm(attribute.Form, ns != attribute.Namespace);
                    attribute.Mapping = ImportTypeMapping(modelScope.GetTypeModel(targetType), ns, ImportContext.Attribute, a.XmlAttribute.DataType, XmlSchemaForm.Qualified, isList);
                    attribute.IsList = isList;
                    attribute.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
                    attribute.Any = (a.XmlAnyAttribute != null);
                    accessor.Attribute = attribute;

                }
                else if ((flags & elemFlags) != 0) {
                    if ((flags & elemFlags) != flags)
                        throw new InvalidOperationException(Res.GetString(Res.XmlIllegalElementsArrayAttribute));
                    
                    if (a.XmlText != null) {
                        TextAccessor text = new TextAccessor();
                        Type targetType = a.XmlText.Type == null ? arrayElementType : a.XmlText.Type;
                        TypeDesc targetTypeDesc = typeScope.GetTypeDesc(targetType);
                        text.Name = accessorName; // unused except to make more helpful error messages
                        text.Mapping = ImportTypeMapping(modelScope.GetTypeModel(targetType), ns, ImportContext.Text, a.XmlText.DataType, XmlSchemaForm.Qualified, true);
                        if (!(text.Mapping is SpecialMapping) && targetTypeDesc != typeScope.GetTypeDesc(typeof(string)))
                            throw new InvalidOperationException(Res.GetString(Res.XmlIllegalArrayTextAttribute, accessorName));

                        accessor.Text = text;
                    }
                    if (a.XmlText == null && a.XmlElements.Count == 0 && a.XmlAnyElements.Count == 0)
                        a.XmlElements.Add(CreateElementAttribute(accessor.TypeDesc));
                    
                    for (int i = 0; i < a.XmlElements.Count; i++) {
                        XmlElementAttribute xmlElement = a.XmlElements[i];
                        Type targetType = xmlElement.Type == null ? arrayElementType : xmlElement.Type;
                        TypeDesc targetTypeDesc = typeScope.GetTypeDesc(targetType);
                        TypeModel typeModel = modelScope.GetTypeModel(targetType);
                        ElementAccessor element = new ElementAccessor();
                        element.Namespace = xmlElement.Namespace == null ? ns : xmlElement.Namespace;
                        element.Mapping = ImportTypeMapping(typeModel, element.Namespace, ImportContext.Element, xmlElement.DataType);
                        if (a.XmlElements.Count == 1) {
	                        element.Name = Accessor.EscapeName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName, false);
                        }
                        else {
	                        element.Name = Accessor.EscapeName(xmlElement.ElementName.Length == 0 ? element.Mapping.TypeName : xmlElement.ElementName, false);
                        }
                        element.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
                        element.IsNullable = xmlElement.IsNullable;
                        element.Form = xmlElement.Form == XmlSchemaForm.None ? form : xmlElement.Form;
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:xmlreflectionimporter.cs


示例8: ClassHeaderCode

		public override void ClassHeaderCode(StreamWriter outStream, string dotnetClassName, string elementName, 
			string complexTypeBaseClass, bool baseIsAbstract, bool isSchemaType, bool isAbstract, bool isLocalComplexType, Hashtable enumerableClasses, 
			string ns, XmlSchemaForm elementFormDefault, string annotation, bool isElementNullable, ArrayList xmlIncludedClasses,
			bool globalElementAndSchemaTypeHaveSameName)
		{
			outStream.WriteLine();
			outStream.WriteLine();
			
            string nameSpace = "";
			if (isSchemaType)
			{
				if (elementFormDefault == XmlSchemaForm.Qualified || elementFormDefault == XmlSchemaForm.Unqualified) 
				{
					nameSpace = CalculateNamespace(schemaTargetNamespace, ns, false);
				}
				if (globalElementAndSchemaTypeHaveSameName)
				{
					outStream.WriteLine("\t[XmlRoot(ElementName=\"{0}\"{1},IsNullable={2}),Serializable]", 
						elementName, nameSpace, isElementNullable.ToString().ToLower());
					outStream.WriteLine("\t[XmlType(TypeName=\"{0}\"{1})]", 
						dotnetClassName, nameSpace);
				}
				else
				{
					outStream.WriteLine("\t[XmlType(TypeName=\"{0}\"{1}),Serializable]", dotnetClassName, nameSpace);
				}
			}
			else if (isLocalComplexType)
			{
				if (elementFormDefault == XmlSchemaForm.Qualified || elementFormDefault == XmlSchemaForm.Unqualified) 
				{
					nameSpace = CalculateNamespace(schemaTargetNamespace, ns, false);
				}
				outStream.WriteLine("\t[XmlType(TypeName=\"{0}\"{1}),Serializable]", 
					dotnetClassName, nameSpace);
			}
			else 
			{
				// possible root node element -- so put namespace on the element if targetNamesapce has been set
				nameSpace = CalculateNamespace(schemaTargetNamespace, ns, false);
				outStream.WriteLine("\t[XmlRoot(ElementName=\"{0}\"{1},IsNullable={2}),Serializable]", 
					elementName, nameSpace, isElementNullable.ToString().ToLower());
			}

			// Add necessary XmlInludes for abstract derived types used in the class
			foreach (string xmlIncludeClass in xmlIncludedClasses)
			{
				outStream.WriteLine("\t[XmlInclude(typeof({0}))]", CheckForKeywords(xmlIncludeClass));
			}
			
			string className = CheckForKeywords(dotnetClassName);
            outStream.Write("\tpublic {1}{2}class {0}", className, isAbstract ? "abstract " : "", partialClasses ? PartialKeyword : "");

			// setup inheritance for <xsd:extension base="class"> 
			if (complexTypeBaseClass != null && complexTypeBaseClass != "")
				outStream.Write(" : {0}", CheckForKeywords(complexTypeBaseClass));

			outStream.WriteLine();
			outStream.WriteLine("\t{");

			// setup enumerability over a contained collection
			if (enumerableClasses.ContainsKey(dotnetClassName))
			{
				ArrayList values = (ArrayList) enumerableClasses[dotnetClassName];
				string collectionName = (string) values[0];
				collectionName = ReplaceInvalidChars(collectionName);
				outStream.WriteLine(ClassEnumerabilityTemplate, collectionName,
                    ConvertSystemDatatype((string)values[1]), collectionSuffix, hiddenMemberPrefix);
			}
		}
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:70,代码来源:CSharpTemplate.cs


示例9: ImportAccessorMapping

        void ImportAccessorMapping(MemberMapping accessor, FieldModel model, SoapAttributes a, string ns, XmlSchemaForm form) {
            Type accessorType = model.FieldType;
            string accessorName = model.Name;
            accessor.TypeDesc = typeScope.GetTypeDesc(accessorType);
            if (accessor.TypeDesc.IsVoid) {
                throw new InvalidOperationException(Res.GetString(Res.XmlInvalidVoid));
            }

            SoapAttributeFlags flags = a.SoapFlags;
            if ((flags & SoapAttributeFlags.Attribute) == SoapAttributeFlags.Attribute) {
                if (!accessor.TypeDesc.IsPrimitive && !accessor.TypeDesc.IsEnum)
                    throw new InvalidOperationException(Res.GetString(Res.XmlIllegalSoapAttribute, accessorName, accessor.TypeDesc.FullName));

                if ((flags & SoapAttributeFlags.Attribute) != flags)
                    throw new InvalidOperationException(Res.GetString(Res.XmlInvalidElementAttribute));
                
                AttributeAccessor attribute = new AttributeAccessor();
                attribute.Name = Accessor.EscapeQName(a.SoapAttribute == null || a.SoapAttribute.AttributeName.Length == 0 ? accessorName : a.SoapAttribute.AttributeName);
                attribute.Namespace = a.SoapAttribute == null || a.SoapAttribute.Namespace == null ? ns : a.SoapAttribute.Namespace;
                attribute.Form = XmlSchemaForm.Qualified; // attributes are always qualified since they're only used for encoded soap headers
                attribute.Mapping = ImportTypeMapping(modelScope.GetTypeModel(accessorType), (a.SoapAttribute == null ? String.Empty : a.SoapAttribute.DataType));
                attribute.Default = GetDefaultValue(model.FieldTypeDesc, a);
                accessor.Attribute = attribute;
                accessor.Elements = new ElementAccessor[0];
            }
            else {
                if ((flags & SoapAttributeFlags.Element) != flags)
                    throw new InvalidOperationException(Res.GetString(Res.XmlInvalidElementAttribute));

                ElementAccessor element = new ElementAccessor();
                element.IsSoap = true;
                element.Name = XmlConvert.EncodeLocalName(a.SoapElement == null || a.SoapElement.ElementName.Length == 0 ? accessorName : a.SoapElement.ElementName);
                element.Namespace = ns;
                element.Form = form;
                element.Mapping = ImportTypeMapping(modelScope.GetTypeModel(accessorType), (a.SoapElement == null ? String.Empty : a.SoapElement.DataType));
                if (a.SoapElement != null)
                    element.IsNullable = a.SoapElement.IsNullable;
                accessor.Elements = new ElementAccessor[] { element };
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:40,代码来源:soapreflectionimporter.cs


示例10: GetForm

		XmlSchemaForm GetForm (XmlSchemaForm form, string ns, bool forElement)
		{
			// Returns the schema form for an element or attribute, taking
			// into account the schema defaults. If the form has not been explicitly
			// set and there is no default, use Unqualified as default.
			
			if (form != XmlSchemaForm.None)
				return form;
			XmlSchema s = schemas [ns];
			if (s == null)
				return XmlSchemaForm.Unqualified;
			XmlSchemaForm schemaForm = forElement ? s.ElementFormDefault : s.AttributeFormDefault;
			if (schemaForm != XmlSchemaForm.None)
				return schemaForm;
			else
				return XmlSchemaForm.Unqualified;
		}
开发者ID:nestalk,项目名称:mono,代码行数:17,代码来源:XmlSchemaImporter.cs


示例11: MemberInfo

		/// <summary>
		/// Creates a new <see cref="MemberInfo"/> instance.
		/// </summary>
		protected MemberInfo( )
		{
			_nodeName = string.Empty;
			_nodeType = XPathNodeType.Element;
			Form = XmlSchemaForm.None;
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:9,代码来源:MemberInfo.cs


示例12: SetSchemaDefaults

 private void SetSchemaDefaults(XmlSchema schema) {
     if (schema.BlockDefault == XmlSchemaDerivationMethod.All) {
         this.blockDefault = XmlSchemaDerivationMethod.All;
     }
     else if (schema.BlockDefault == XmlSchemaDerivationMethod.None) {
         this.blockDefault = XmlSchemaDerivationMethod.Empty;
     }
     else {
         if ((schema.BlockDefault & ~schemaBlockDefaultAllowed) != 0) {
             SendValidationEvent(Res.Sch_InvalidBlockDefaultValue, schema);
         }
         this.blockDefault = schema.BlockDefault & schemaBlockDefaultAllowed;
     }
     if (schema.FinalDefault == XmlSchemaDerivationMethod.All) {
         this.finalDefault = XmlSchemaDerivationMethod.All;
     }
     else if (schema.FinalDefault == XmlSchemaDerivationMethod.None) {
         this.finalDefault = XmlSchemaDerivationMethod.Empty;
     }
     else {
         if ((schema.FinalDefault & ~schemaFinalDefaultAllowed) != 0) {
             SendValidationEvent(Res.Sch_InvalidFinalDefaultValue, schema);
         }
         this.finalDefault = schema.FinalDefault & schemaFinalDefaultAllowed;
     }
     this.elementFormDefault = schema.ElementFormDefault;
     if (this.elementFormDefault == XmlSchemaForm.None) {
         this.elementFormDefault = XmlSchemaForm.Unqualified;
     }
     this.attributeFormDefault = schema.AttributeFormDefault;
     if (this.attributeFormDefault == XmlSchemaForm.None) {
         this.attributeFormDefault = XmlSchemaForm.Unqualified;
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:Preprocessor.cs


示例13: ImportElement

        ElementAccessor ImportElement(TypeModel model, XmlRootAttribute root, string defaultNamespace, XmlSchemaForm form) {
            XmlAttributes a = GetAttributes(model.Type);

            if (root == null)
                root = a.XmlRoot;
            string ns = root == null ? null : root.Namespace;
            if (ns == null) ns = defaultNamespace;
            if (ns == null) ns = this.defaultNs;

            arrayNestingLevel = -1;
            savedArrayItemAttributes = null;
            savedArrayNamespace = null;
            ElementAccessor element = CreateElementAccessor(ImportTypeMapping(model, ns, ImportContext.Element, string.Empty, form, false), ns);

            if (root != null) {
                if (root.ElementName.Length > 0)
                    element.Name = Accessor.EscapeName(root.ElementName, false);
                element.IsNullable = root.IsNullableSpecified ? root.IsNullable : model.TypeDesc.IsNullable;
                CheckNullable(element.IsNullable, model.TypeDesc);
            }
            else
                element.IsNullable = model.TypeDesc.IsNullable;
            element.Form = form;
            return ReconcileAccessor(element);
        }
开发者ID:ArildF,项目名称:masters,代码行数:25,代码来源:xmlreflectionimporter.cs


示例14: ExportMetadata

        void ExportMetadata(CodeAttributeDeclarationCollection metadata, Type attributeType, string name, string ns, TypeDesc typeDesc, TypeDesc dataTypeDesc, object isNullable, XmlSchemaForm form, int nestingLevel, int sequenceId) {
            CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(attributeType.FullName);
            if (name != null) {
                attribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(name)));
            }
            if (typeDesc != null) {
                if (isNullable != null && (bool)isNullable && typeDesc.IsValueType && !typeDesc.IsMappedType && CodeProvider.Supports(GeneratorSupport.GenericTypeReference)) {
                    attribute.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression("System.Nullable`1[" + typeDesc.FullName + "]")));
                    isNullable = null;
                }
                else {
                    attribute.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression(typeDesc.FullName)));
                }
            }
            if (form != XmlSchemaForm.None) {
                attribute.Arguments.Add(new CodeAttributeArgument("Form", new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(XmlSchemaForm).FullName), Enum.Format(typeof(XmlSchemaForm), form, "G"))));

                if (form == XmlSchemaForm.Unqualified && ns != null && ns.Length == 0) {
                    ns = null;
                }
            }
            if (ns != null ) {
                attribute.Arguments.Add(new CodeAttributeArgument("Namespace", new CodePrimitiveExpression(ns)));
            }
            if (dataTypeDesc != null && dataTypeDesc.IsAmbiguousDataType && !dataTypeDesc.IsMappedType) {
                attribute.Arguments.Add(new CodeAttributeArgument("DataType", new CodePrimitiveExpression(dataTypeDesc.DataType.Name)));
            }
            if (isNullable != null) {
                attribute.Arguments.Add(new CodeAttributeArgument("IsNullable", new CodePrimitiveExpression((bool)isNullable)));
            }
            if (nestingLevel > 0) {
                attribute.Arguments.Add(new CodeAttributeArgument("NestingLevel", new CodePrimitiveExpression(nestingLevel)));
            }
            if (sequenceId >= 0) {
                attribute.Arguments.Add(new CodeAttributeArgument("Order", new CodePrimitiveExpression(sequenceId)));
            }
            if (attribute.Arguments.Count == 0 && attributeType == typeof(XmlElementAttribute)) return;
            metadata.Add(attribute);
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:39,代码来源:xmlcodeexporter.cs


示例15: ExportArray

 void ExportArray(CodeAttributeDeclarationCollection metadata, string name, string ns, bool isNullable, XmlSchemaForm form, int sequenceId) {
     ExportMetadata(metadata, typeof(XmlArrayAttribute), name, ns, null, null, isNullable ? (object)true : null, form, 0, sequenceId);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:3,代码来源:xmlcodeexporter.cs


示例16: ExportElement

 void ExportElement(CodeAttributeDeclarationCollection metadata, string name, string ns, TypeDesc typeDesc, TypeDesc dataTypeDesc, bool isNullable, XmlSchemaForm form, int sequenceId) {
     ExportMetadata(metadata, typeof(XmlElementAttribute), name, ns, typeDesc, dataTypeDesc, isNullable ? (object)true : null, form, 0, sequenceId);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:3,代码来源:xmlcodeexporter.cs


示例17: ExportArrayItem

 void ExportArrayItem(CodeAttributeDeclarationCollection metadata, string name, string ns, TypeDesc typeDesc, TypeDesc dataTypeDesc, bool isNullable, XmlSchemaForm form, int nestingLevel) {
     ExportMetadata(metadata, typeof(XmlArrayItemAttribute), name, ns, typeDesc, dataTypeDesc, isNullable ? null : (object)false, form, nestingLevel, -1);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:3,代码来源:xmlcodeexporter.cs


示例18: ExportAttribute

 void ExportAttribute(CodeAttributeDeclarationCollection metadata, string name, string ns, TypeDesc typeDesc, TypeDesc dataTypeDesc, XmlSchemaForm form) {
     ExportMetadata(metadata, typeof(XmlAttributeAttribute), name, ns, typeDesc, dataTypeDesc, null, form, 0, -1);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:3,代码来源:xmlcodeexporter.cs


示例19: CreateElementInfo

		XmlTypeMapElementInfo CreateElementInfo (string ns, XmlTypeMapMember member, string name, TypeData typeData, bool isNillable, XmlSchemaForm form, XmlTypeMapping emap)
		{
			XmlTypeMapElementInfo einfo = new XmlTypeMapElementInfo (member, typeData);
			einfo.ElementName = name;
			einfo.Namespace = ns;
			einfo.IsNullable = isNillable;
			einfo.Form = form;
			if (typeData.IsComplexType)
				einfo.MappedType = emap;
			return einfo;
		}
开发者ID:stabbylambda,项目名称:mono,代码行数:11,代码来源:XmlSchemaImporter.cs


示例20: CreateElementInfo

		XmlTypeMapElementInfo CreateElementInfo (string ns, XmlTypeMapMember member, string name, TypeData typeData, bool isNillable, XmlSchemaForm form, int order)
		{
			if (typeData.IsComplexType)
				return CreateElementInfo (ns, member, name, typeData, isNillable, form, GetTypeMapping (typeData), order);
			else
				return CreateElementInfo (ns, member, name, typeData, isNillable, form, null, order);
		}
开发者ID:nestalk,项目名称:mono,代码行数:7,代码来源:XmlSchemaImporter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# XmlSerializer类代码示例发布时间:2022-05-24
下一篇:
C# XmlSchemaDatatype类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap