本文整理汇总了C#中System.Xml.Schema.XdrBuilder.SendValidationEvent方法的典型用法代码示例。如果您正苦于以下问题:C# XdrBuilder.SendValidationEvent方法的具体用法?C# XdrBuilder.SendValidationEvent怎么用?C# XdrBuilder.SendValidationEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XdrBuilder
的用法示例。
在下文中一共展示了XdrBuilder.SendValidationEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XDR_BeginAttribute
private static void XDR_BeginAttribute(XdrBuilder builder)
{
if (builder._BaseDecl._TypeName.IsEmpty)
{
builder.SendValidationEvent("Sch_MissAttribute");
}
SchemaAttDef pAttdef = null;
XmlQualifiedName name = builder._BaseDecl._TypeName;
string ns = builder._BaseDecl._Prefix;
if (builder._ElementDef._AttDefList != null)
{
pAttdef = (SchemaAttDef) builder._ElementDef._AttDefList[name];
}
if (pAttdef == null)
{
SchemaAttDef def2;
XmlQualifiedName key = name;
if (ns.Length == 0)
{
key = new XmlQualifiedName(name.Name, builder._TargetNamespace);
}
if (builder._SchemaInfo.AttributeDecls.TryGetValue(key, out def2))
{
pAttdef = def2.Clone();
pAttdef.Name = name;
}
else if (ns.Length != 0)
{
builder.SendValidationEvent("Sch_UndeclaredAttribute", XmlQualifiedName.ToString(name.Name, ns));
}
}
if (pAttdef != null)
{
builder.XDR_CheckAttributeDefault(builder._BaseDecl, pAttdef);
}
else
{
pAttdef = new SchemaAttDef(name, ns);
DeclBaseInfo info = new DeclBaseInfo {
_Checking = true,
_Attdef = pAttdef,
_TypeName = builder._BaseDecl._TypeName,
_ElementDecl = builder._ElementDef._ElementDecl,
_MinOccurs = builder._BaseDecl._MinOccurs,
_Default = builder._BaseDecl._Default,
_Next = builder._UndefinedAttributeTypes
};
builder._UndefinedAttributeTypes = info;
}
builder._ElementDef._ElementDecl.AddAttDef(pAttdef);
}
示例2: XDR_BuildElementType_Name
private static void XDR_BuildElementType_Name(XdrBuilder builder, object obj, string prefix)
{
XmlQualifiedName qname = (XmlQualifiedName)obj;
if (builder._SchemaInfo.ElementDecls.ContainsKey(qname))
{
builder.SendValidationEvent(SR.Sch_DupElementDecl, XmlQualifiedName.ToString(qname.Name, prefix));
}
builder._ElementDef._ElementDecl.Name = qname;
builder._ElementDef._ElementDecl.Prefix = prefix;
builder._SchemaInfo.ElementDecls.Add(qname, builder._ElementDef._ElementDecl);
if (builder._UndeclaredElements[qname] != null)
{
builder._UndeclaredElements.Remove(qname);
}
}
示例3: XDR_BeginElementType
//.........这里部分代码省略.........
string msg = null;
//
// check name attribute
//
if (builder._ElementDef._ElementDecl.Name.IsEmpty)
{
code = SR.Sch_MissAttribute;
msg = "name";
goto cleanup;
}
//
// check dt:type attribute
//
if (builder._ElementDef._HasDataType)
{
if (!builder._ElementDef._AllowDataType)
{
code = SR.Sch_DataTypeTextOnly;
goto cleanup;
}
else
{
builder._ElementDef._ContentAttr = SchemaContentText;
}
}
else if (builder._ElementDef._ContentAttr == SchemaContentNone)
{
switch (builder._ElementDef._OrderAttr)
{
case SchemaOrderNone:
builder._ElementDef._ContentAttr = SchemaContentMixed;
builder._ElementDef._OrderAttr = SchemaOrderMany;
break;
case SchemaOrderSequence:
builder._ElementDef._ContentAttr = SchemaContentElement;
break;
case SchemaOrderChoice:
builder._ElementDef._ContentAttr = SchemaContentElement;
break;
case SchemaOrderMany:
builder._ElementDef._ContentAttr = SchemaContentMixed;
break;
}
}
//save the model value from the base
bool tempOpen = builder._contentValidator.IsOpen;
ElementContent def = builder._ElementDef;
switch (builder._ElementDef._ContentAttr)
{
case SchemaContentText:
builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.TextOnly;
builder._GroupDef._Order = SchemaOrderMany;
builder._contentValidator = null;
break;
case SchemaContentElement:
builder._contentValidator = new ParticleContentValidator(XmlSchemaContentType.ElementOnly);
if (def._OrderAttr == SchemaOrderNone)
{
builder._GroupDef._Order = SchemaOrderSequence;
}
def._MasterGroupRequired = true;
builder._contentValidator.IsOpen = tempOpen;
break;
case SchemaContentEmpty:
builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.Empty;
builder._contentValidator = null;
break;
case SchemaContentMixed:
if (def._OrderAttr == SchemaOrderNone || def._OrderAttr == SchemaOrderMany)
{
builder._GroupDef._Order = SchemaOrderMany;
}
else
{
code = SR.Sch_MixedMany;
goto cleanup;
}
def._MasterGroupRequired = true;
builder._contentValidator.IsOpen = tempOpen;
break;
}
if (def._ContentAttr == SchemaContentMixed || def._ContentAttr == SchemaContentElement)
{
builder._contentValidator.Start();
builder._contentValidator.OpenGroup();
}
cleanup:
if (code != null)
{
builder.SendValidationEvent(code, msg);
}
}
示例4: ParseMaxOccurs
private static uint ParseMaxOccurs(object obj, XdrBuilder builder)
{
uint cVal = uint.MaxValue;
string s = (string)obj;
if (!s.Equals("*") &&
(!ParseInteger(s, ref cVal) || (cVal != uint.MaxValue && cVal != 1)))
{
builder.SendValidationEvent(SR.Sch_MaxOccursInvalid);
}
return cVal;
}
示例5: CompareMinMaxLength
private static void CompareMinMaxLength(uint cMin, uint cMax, XdrBuilder builder)
{
if (cMin != uint.MaxValue && cMax != uint.MaxValue && cMin > cMax)
{
builder.SendValidationEvent(SR.Sch_DtMinMaxLength);
}
}
示例6: XDR_InitAttributeDtType
private static void XDR_InitAttributeDtType(XdrBuilder builder, object obj)
{
if (builder._AttributeDef._HasDataType)
{
builder.SendValidationEvent(SR.Sch_DupDtType);
}
}
示例7: IsYes
private static bool IsYes(object obj, XdrBuilder builder)
{
XmlQualifiedName qname = (XmlQualifiedName)obj;
bool fYes = false;
if (qname.Name == "yes")
{
fYes = true;
}
else if (qname.Name != "no")
{
builder.SendValidationEvent(SR.Sch_UnknownRequired);
}
return fYes;
}
示例8: XDR_BuildAttributeType_Name
private static void XDR_BuildAttributeType_Name(XdrBuilder builder, object obj, string prefix)
{
XmlQualifiedName qname = (XmlQualifiedName)obj;
builder._AttributeDef._Name = qname;
builder._AttributeDef._Prefix = prefix;
builder._AttributeDef._AttDef.Name = qname;
if (builder._ElementDef._ElementDecl != null)
{ // Local AttributeType
if (builder._ElementDef._AttDefList[qname] == null)
{
builder._ElementDef._AttDefList.Add(qname, builder._AttributeDef._AttDef);
}
else
{
builder.SendValidationEvent(SR.Sch_DupAttribute, XmlQualifiedName.ToString(qname.Name, prefix));
}
}
else
{ // Global AttributeType
// Global AttributeTypes are URN qualified so that we can look them up across schemas.
qname = new XmlQualifiedName(qname.Name, builder._TargetNamespace);
builder._AttributeDef._AttDef.Name = qname;
if (!builder._SchemaInfo.AttributeDecls.ContainsKey(qname))
{
builder._SchemaInfo.AttributeDecls.Add(qname, builder._AttributeDef._AttDef);
}
else
{
builder.SendValidationEvent(SR.Sch_DupAttribute, XmlQualifiedName.ToString(qname.Name, prefix));
}
}
}
示例9: XDR_BeginAttributeType
private static void XDR_BeginAttributeType(XdrBuilder builder)
{
if (builder._AttributeDef._Name.IsEmpty)
{
builder.SendValidationEvent(SR.Sch_MissAttribute);
}
}
示例10: XDR_BuildGroup_Order
private static void XDR_BuildGroup_Order(XdrBuilder builder, object obj, string prefix)
{
builder._GroupDef._Order = builder.GetOrder((XmlQualifiedName) obj);
if ((builder._ElementDef._ContentAttr == 3) && (builder._GroupDef._Order != 1))
{
builder.SendValidationEvent("Sch_MixedMany");
}
}
示例11: 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);
}
}
示例12: XDR_BuildElementType_Name
private static void XDR_BuildElementType_Name(XdrBuilder builder, object obj, string prefix)
{
XmlQualifiedName key = (XmlQualifiedName) obj;
if (builder._SchemaInfo.ElementDecls.ContainsKey(key))
{
builder.SendValidationEvent("Sch_DupElementDecl", XmlQualifiedName.ToString(key.Name, prefix));
}
builder._ElementDef._ElementDecl.Name = key;
builder._ElementDef._ElementDecl.Prefix = prefix;
builder._SchemaInfo.ElementDecls.Add(key, builder._ElementDef._ElementDecl);
if (builder._UndeclaredElements[key] != null)
{
builder._UndeclaredElements.Remove(key);
}
}
示例13: XDR_BuildAttributeType_Name
private static void XDR_BuildAttributeType_Name(XdrBuilder builder, object obj, string prefix)
{
XmlQualifiedName key = (XmlQualifiedName) obj;
builder._AttributeDef._Name = key;
builder._AttributeDef._Prefix = prefix;
builder._AttributeDef._AttDef.Name = key;
if (builder._ElementDef._ElementDecl != null)
{
if (builder._ElementDef._AttDefList[key] == null)
{
builder._ElementDef._AttDefList.Add(key, builder._AttributeDef._AttDef);
}
else
{
builder.SendValidationEvent("Sch_DupAttribute", XmlQualifiedName.ToString(key.Name, prefix));
}
}
else
{
key = new XmlQualifiedName(key.Name, builder._TargetNamespace);
builder._AttributeDef._AttDef.Name = key;
if (!builder._SchemaInfo.AttributeDecls.ContainsKey(key))
{
builder._SchemaInfo.AttributeDecls.Add(key, builder._AttributeDef._AttDef);
}
else
{
builder.SendValidationEvent("Sch_DupAttribute", XmlQualifiedName.ToString(key.Name, prefix));
}
}
}
示例14: XDR_BeginElementType
private static void XDR_BeginElementType(XdrBuilder builder)
{
string code = null;
string msg = null;
if (builder._ElementDef._ElementDecl.Name.IsEmpty)
{
code = "Sch_MissAttribute";
msg = "name";
}
else
{
if (builder._ElementDef._HasDataType)
{
if (!builder._ElementDef._AllowDataType)
{
code = "Sch_DataTypeTextOnly";
goto Label_01F4;
}
builder._ElementDef._ContentAttr = 2;
}
else if (builder._ElementDef._ContentAttr == 0)
{
switch (builder._ElementDef._OrderAttr)
{
case 0:
builder._ElementDef._ContentAttr = 3;
builder._ElementDef._OrderAttr = 1;
break;
case 1:
builder._ElementDef._ContentAttr = 3;
break;
case 2:
builder._ElementDef._ContentAttr = 4;
break;
case 3:
builder._ElementDef._ContentAttr = 4;
break;
}
}
bool isOpen = builder._contentValidator.IsOpen;
ElementContent content = builder._ElementDef;
switch (builder._ElementDef._ContentAttr)
{
case 1:
builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.Empty;
builder._contentValidator = null;
break;
case 2:
builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.TextOnly;
builder._GroupDef._Order = 1;
builder._contentValidator = null;
break;
case 3:
if ((content._OrderAttr != 0) && (content._OrderAttr != 1))
{
code = "Sch_MixedMany";
goto Label_01F4;
}
builder._GroupDef._Order = 1;
content._MasterGroupRequired = true;
builder._contentValidator.IsOpen = isOpen;
break;
case 4:
builder._contentValidator = new ParticleContentValidator(XmlSchemaContentType.ElementOnly);
if (content._OrderAttr == 0)
{
builder._GroupDef._Order = 2;
}
content._MasterGroupRequired = true;
builder._contentValidator.IsOpen = isOpen;
break;
}
if ((content._ContentAttr == 3) || (content._ContentAttr == 4))
{
builder._contentValidator.Start();
builder._contentValidator.OpenGroup();
}
}
Label_01F4:
if (code != null)
{
builder.SendValidationEvent(code, msg);
}
}
示例15: XDR_InitElementDtType
//
// DataType
//
private static void XDR_InitElementDtType(XdrBuilder builder, object obj)
{
if (builder._ElementDef._HasDataType)
{
builder.SendValidationEvent(SR.Sch_DupDtType);
}
if (!builder._ElementDef._AllowDataType)
{
builder.SendValidationEvent(SR.Sch_DataTypeTextOnly);
}
}