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


C# Schema.XmlSchemaAttribute类代码示例

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


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

示例1: GetTypedTableSchema

 public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs) {
     System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
     System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
     IBDataset ds = new IBDataset();
     xs.Add(ds.GetSchemaSerializable());
     System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "SPR_TOVDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     return type;
 }
开发者ID:vpjulia,项目名称:Salvia,代码行数:27,代码来源:IBDataset.Designer.cs

示例2: GetTypedDataSetSchema

 public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs) {
     NorthwindDataSet ds = new NorthwindDataSet();
     System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
     System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
     xs.Add(ds.GetSchemaSerializable());
     if (PublishLegacyWSDL()) {
         System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
         any.Namespace = ds.Namespace;
         sequence.Items.Add(any);
     }
     else {
         System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
         any1.Namespace = "http://www.w3.org/2001/XMLSchema";
         any1.MinOccurs = new decimal(0);
         any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
         sequence.Items.Add(any1);
         System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
         any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
         any2.MinOccurs = new decimal(0);
         any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
         sequence.Items.Add(any2);
         sequence.MaxOccurs = decimal.MaxValue;
         System.Xml.Schema.XmlSchemaAttribute attribute = new System.Xml.Schema.XmlSchemaAttribute();
         attribute.Name = "namespace";
         attribute.FixedValue = ds.Namespace;
         type.Attributes.Add(attribute);
     }
     type.Particle = sequence;
     return type;
 }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:30,代码来源:NorthwindDataSet.Designer.cs

示例3: AssessAttributeLocallyValidUse

		private void AssessAttributeLocallyValidUse (XsAttribute attr)
		{
			// This is extra check than spec 3.5.4
			if (attr.ValidatedUse == XmlSchemaUse.Prohibited)
				HandleError ("Attribute " + attr.QualifiedName + " is prohibited in this context.");
		}
开发者ID:zxlin25,项目名称:mono,代码行数:6,代码来源:XmlSchemaValidator.cs

示例4: ValidateKeyFieldsAttribute

		private void ValidateKeyFieldsAttribute (XsAttribute attr, object value)
		{
			ValidateKeyFields (true, false, attr.AttributeType, attr.QualifiedName.Name, attr.QualifiedName.Namespace, value);
		}
开发者ID:zxlin25,项目名称:mono,代码行数:4,代码来源:XmlSchemaValidator.cs

示例5: AssessAttributeLocallyValid

		// 3.2.4 Attribute Locally Valid and 3.4.4
		private object AssessAttributeLocallyValid (XsAttribute attr, XmlSchemaInfo info, XmlValueGetter getter)
		{
			if (info != null) {
				info.SchemaAttribute = attr;
				info.SchemaType = attr.AttributeSchemaType;
			}

			// 2. - 4.
			if (attr.AttributeType == null)
				HandleError ("Attribute type is missing for " + attr.QualifiedName);
			XsDatatype dt = attr.AttributeType as XsDatatype;
			if (dt == null)
				dt = ((SimpleType) attr.AttributeType).Datatype;

			object parsedValue = null;

			// It is a bit heavy process, so let's omit as long as possible ;-)
			if (dt != SimpleType.AnySimpleType || attr.ValidatedFixedValue != null) {
				try {
					CurrentAttributeType = dt;
					parsedValue = getter ();
				} catch (Exception ex) { // It is inevitable and bad manner.
					HandleError (String.Format ("Attribute value is invalid against its data type {0}", dt != null ? dt.TokenizedType : default (XmlTokenizedType)), ex);
				}

				// check part of 3.14.4 StringValid
				SimpleType st = attr.AttributeSchemaType;
				if (st != null) {
					string xav = null;
					try {
						xav = new XmlAtomicValue (parsedValue, attr.AttributeSchemaType).Value;
					} catch (Exception ex) {
						HandleError (String.Format ("Failed to convert attribute value to type {0}", st.QualifiedName), ex);
					}
					if (xav != null)
						ValidateRestrictedSimpleTypeValue (st, ref dt, xav);
				}

				if (attr.ValidatedFixedValue != null) {
					if (!XmlSchemaUtil.AreSchemaDatatypeEqual (attr.AttributeSchemaType, attr.ValidatedFixedTypedValue, attr.AttributeSchemaType, parsedValue))
						HandleError (String.Format ("The value of the attribute {0} does not match with its fixed value '{1}' in the space of type {2}", attr.QualifiedName, attr.ValidatedFixedValue, dt));
					parsedValue = attr.ValidatedFixedTypedValue;
				}
			}

#region ID Constraints
			if (!IgnoreIdentity) {
				string error = idManager.AssessEachAttributeIdentityConstraint (dt, parsedValue, ((QName) elementQNameStack [elementQNameStack.Count - 1]).Name);
				if (error != null)
					HandleError (error);
			}
#endregion

#region Key Constraints
			if (!IgnoreIdentity)
				ValidateKeyFieldsAttribute (attr, parsedValue);
#endregion

			return parsedValue;
		}
开发者ID:zxlin25,项目名称:mono,代码行数:61,代码来源:XmlSchemaValidator.cs


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