本文整理汇总了C#中System.Xml.Schema.XdrBuilder.SetAttributePresence方法的典型用法代码示例。如果您正苦于以下问题:C# XdrBuilder.SetAttributePresence方法的具体用法?C# XdrBuilder.SetAttributePresence怎么用?C# XdrBuilder.SetAttributePresence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XdrBuilder
的用法示例。
在下文中一共展示了XdrBuilder.SetAttributePresence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XDR_EndAttributeType
private static void XDR_EndAttributeType(XdrBuilder builder)
{
string code = null;
if (builder._AttributeDef._HasDataType && builder._AttributeDef._AttDef.Datatype != null)
{
XmlTokenizedType ttype = builder._AttributeDef._AttDef.Datatype.TokenizedType;
if (ttype == XmlTokenizedType.ENUMERATION && !builder._AttributeDef._EnumerationRequired)
{
code = SR.Sch_MissDtvaluesAttribute;
goto cleanup;
}
if (ttype != XmlTokenizedType.ENUMERATION && builder._AttributeDef._EnumerationRequired)
{
code = SR.Sch_RequireEnumeration;
goto cleanup;
}
// a attributes of type id is not supposed to have a default value
if (builder._AttributeDef._Default != null && ttype == XmlTokenizedType.ID)
{
code = SR.Sch_DefaultIdValue;
goto cleanup;
}
}
else
{
builder._AttributeDef._AttDef.Datatype = XmlSchemaDatatype.FromXmlTokenizedType(XmlTokenizedType.CDATA);
}
//
// constraints
//
CompareMinMaxLength(builder._AttributeDef._MinLength, builder._AttributeDef._MaxLength, builder);
builder._AttributeDef._AttDef.MaxLength = builder._AttributeDef._MaxLength;
builder._AttributeDef._AttDef.MinLength = builder._AttributeDef._MinLength;
//
// checkAttributeType
//
if (builder._AttributeDef._Default != null)
{
builder._AttributeDef._AttDef.DefaultValueRaw = builder._AttributeDef._AttDef.DefaultValueExpanded = (string)builder._AttributeDef._Default;
builder.CheckDefaultAttValue(builder._AttributeDef._AttDef);
}
builder.SetAttributePresence(builder._AttributeDef._AttDef, builder._AttributeDef._Required);
cleanup:
if (code != null)
{
builder.SendValidationEvent(code);
}
}
示例2: XDR_EndAttributeType
private static void XDR_EndAttributeType(XdrBuilder builder)
{
string code = null;
if (builder._AttributeDef._HasDataType && (builder._AttributeDef._AttDef.Datatype != null))
{
XmlTokenizedType tokenizedType = builder._AttributeDef._AttDef.Datatype.TokenizedType;
if ((tokenizedType == XmlTokenizedType.ENUMERATION) && !builder._AttributeDef._EnumerationRequired)
{
code = "Sch_MissDtvaluesAttribute";
}
else if ((tokenizedType != XmlTokenizedType.ENUMERATION) && builder._AttributeDef._EnumerationRequired)
{
code = "Sch_RequireEnumeration";
}
else
{
if ((builder._AttributeDef._Default == null) || (tokenizedType != XmlTokenizedType.ID))
{
goto Label_00A3;
}
code = "Sch_DefaultIdValue";
}
goto Label_0164;
}
builder._AttributeDef._AttDef.Datatype = XmlSchemaDatatype.FromXmlTokenizedType(XmlTokenizedType.CDATA);
Label_00A3:
CompareMinMaxLength(builder._AttributeDef._MinLength, builder._AttributeDef._MaxLength, builder);
builder._AttributeDef._AttDef.MaxLength = builder._AttributeDef._MaxLength;
builder._AttributeDef._AttDef.MinLength = builder._AttributeDef._MinLength;
if (builder._AttributeDef._Default != null)
{
builder._AttributeDef._AttDef.DefaultValueRaw = builder._AttributeDef._AttDef.DefaultValueExpanded = (string) builder._AttributeDef._Default;
builder.CheckDefaultAttValue(builder._AttributeDef._AttDef);
}
builder.SetAttributePresence(builder._AttributeDef._AttDef, builder._AttributeDef._Required);
Label_0164:
if (code != null)
{
builder.SendValidationEvent(code);
}
}