本文整理匯總了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);
}
}