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); }
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); } }
private static void XDR_BeginElementType(XdrBuilder builder) { string code = null; 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); } }
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; }
private static void CompareMinMaxLength(uint cMin, uint cMax, XdrBuilder builder) { if (cMin != uint.MaxValue && cMax != uint.MaxValue && cMin > cMax) { builder.SendValidationEvent(SR.Sch_DtMinMaxLength); } }
private static void XDR_InitAttributeDtType(XdrBuilder builder, object obj) { if (builder._AttributeDef._HasDataType) { builder.SendValidationEvent(SR.Sch_DupDtType); } }
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; }
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)); } } }
private static void XDR_BeginAttributeType(XdrBuilder builder) { if (builder._AttributeDef._Name.IsEmpty) { builder.SendValidationEvent(SR.Sch_MissAttribute); } }
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"); } }
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); } }
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); } }
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)); } } }
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); } }
// // 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); } }
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); } }
private static void XDR_EndElementDtType(XdrBuilder builder) { if (!builder._ElementDef._HasDataType) { builder.SendValidationEvent(SR.Sch_MissAttribute); } builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.TextOnly; builder._ElementDef._ContentAttr = SchemaContentText; builder._ElementDef._MasterGroupRequired = false; builder._contentValidator = null; }
// // XDR Element // private static void XDR_InitElement(XdrBuilder builder, object obj) { if (builder._ElementDef._HasDataType || (builder._ElementDef._ContentAttr == SchemaContentEmpty) || (builder._ElementDef._ContentAttr == SchemaContentText)) { builder.SendValidationEvent(SR.Sch_ElementNotAllowed); } builder._ElementDef._AllowDataType = false; builder._ElementDef._HasType = false; builder._ElementDef._MinVal = 1; builder._ElementDef._MaxVal = 1; }
private static void XDR_EndAttributeDtType(XdrBuilder builder) { string code = null; if (!builder._AttributeDef._HasDataType) { code = SR.Sch_MissAttribute; } else { if (builder._AttributeDef._AttDef.Datatype != null) { XmlTokenizedType ttype = builder._AttributeDef._AttDef.Datatype.TokenizedType; if (ttype == XmlTokenizedType.ENUMERATION && !builder._AttributeDef._EnumerationRequired) { code = SR.Sch_MissDtvaluesAttribute; } else if (ttype != XmlTokenizedType.ENUMERATION && builder._AttributeDef._EnumerationRequired) { code = SR.Sch_RequireEnumeration; } } } if (code != null) { builder.SendValidationEvent(code); } }
// private static void XDR_BeginElement(XdrBuilder builder) // { // // } private static void XDR_EndElement(XdrBuilder builder) { if (builder._ElementDef._HasType) { HandleMinMax(builder._contentValidator, builder._ElementDef._MinVal, builder._ElementDef._MaxVal); } else { builder.SendValidationEvent(SR.Sch_MissAttribute); } }
private static uint ParseMinOccurs(object obj, XdrBuilder builder) { uint cVal = 1; if (!ParseInteger((string)obj, ref cVal) || (cVal != 0 && cVal != 1)) { builder.SendValidationEvent(SR.Sch_MinOccursInvalid); } return cVal; }
private static void XDR_BeginAttribute(XdrBuilder builder) { if (builder._BaseDecl._TypeName.IsEmpty) { builder.SendValidationEvent(SR.Sch_MissAttribute); } SchemaAttDef attdef = null; XmlQualifiedName qname = builder._BaseDecl._TypeName; string prefix = builder._BaseDecl._Prefix; // local? if (builder._ElementDef._AttDefList != null) { attdef = (SchemaAttDef)builder._ElementDef._AttDefList[qname]; } // global? if (attdef == null) { // if there is no URN in this name then the name is local to the // schema, but the global attribute was still URN qualified, so // we need to qualify this name now. XmlQualifiedName gname = qname; if (prefix.Length == 0) gname = new XmlQualifiedName(qname.Name, builder._TargetNamespace); SchemaAttDef ad; if (builder._SchemaInfo.AttributeDecls.TryGetValue(gname, out ad)) { attdef = (SchemaAttDef)ad.Clone(); attdef.Name = qname; } else if (prefix.Length != 0) { builder.SendValidationEvent(SR.Sch_UndeclaredAttribute, XmlQualifiedName.ToString(qname.Name, prefix)); } } if (attdef != null) { builder.XDR_CheckAttributeDefault(builder._BaseDecl, attdef); } else { // will process undeclared types later attdef = new SchemaAttDef(qname, prefix); DeclBaseInfo decl = new DeclBaseInfo(); decl._Checking = true; decl._Attdef = attdef; decl._TypeName = builder._BaseDecl._TypeName; decl._ElementDecl = builder._ElementDef._ElementDecl; decl._MinOccurs = builder._BaseDecl._MinOccurs; decl._Default = builder._BaseDecl._Default; // add undefined attribute types decl._Next = builder._UndefinedAttributeTypes; builder._UndefinedAttributeTypes = decl; } builder._ElementDef._ElementDecl.AddAttDef(attdef); }
private static void ParseDtMinLength(ref uint cVal, object obj, XdrBuilder builder) { if (uint.MaxValue != cVal) { builder.SendValidationEvent(SR.Sch_DupDtMinLength); } if (!ParseInteger((string)obj, ref cVal) || cVal < 0) { builder.SendValidationEvent(SR.Sch_DtMinLengthInvalid, obj.ToString()); } }
// // XDR Group // private static void XDR_InitGroup(XdrBuilder builder, object obj) { if (builder._ElementDef._ContentAttr == SchemaContentEmpty || builder._ElementDef._ContentAttr == SchemaContentText) { builder.SendValidationEvent(SR.Sch_GroupDisabled); } builder.PushGroupInfo(); builder._GroupDef._MinVal = 1; builder._GroupDef._MaxVal = 1; builder._GroupDef._HasMaxAttr = false; builder._GroupDef._HasMinAttr = false; if (builder._ElementDef._ExistTerminal) builder.AddOrder(); // now we are in a group so we reset fExistTerminal builder._ElementDef._ExistTerminal = false; builder._contentValidator.OpenGroup(); }
private static void XDR_EndRoot(XdrBuilder builder) { // // check undefined attribute types // We already checked local attribute types, so only need to check global attribute types here // while (builder._UndefinedAttributeTypes != null) { XmlQualifiedName gname = builder._UndefinedAttributeTypes._TypeName; // if there is no URN in this name then the name is local to the // schema, but the global attribute was still URN qualified, so // we need to qualify this name now. if (gname.Namespace.Length == 0) { gname = new XmlQualifiedName(gname.Name, builder._TargetNamespace); } SchemaAttDef ad; if (builder._SchemaInfo.AttributeDecls.TryGetValue(gname, out ad)) { builder._UndefinedAttributeTypes._Attdef = (SchemaAttDef)ad.Clone(); builder._UndefinedAttributeTypes._Attdef.Name = gname; builder.XDR_CheckAttributeDefault(builder._UndefinedAttributeTypes, builder._UndefinedAttributeTypes._Attdef); } else { builder.SendValidationEvent(SR.Sch_UndeclaredAttribute, gname.Name); } builder._UndefinedAttributeTypes = builder._UndefinedAttributeTypes._Next; } foreach (SchemaElementDecl ed in builder._UndeclaredElements.Values) { builder.SendValidationEvent(SR.Sch_UndeclaredElement, XmlQualifiedName.ToString(ed.Name.Name, ed.Prefix)); } }
private static void XDR_BuildGroup_Order(XdrBuilder builder, object obj, string prefix) { builder._GroupDef._Order = builder.GetOrder((XmlQualifiedName)obj); if (builder._ElementDef._ContentAttr == SchemaContentMixed && builder._GroupDef._Order != SchemaOrderMany) { builder.SendValidationEvent(SR.Sch_MixedMany); } }
private static void XDR_BuildElementType_DtType(XdrBuilder builder, object obj, string prefix) { builder._ElementDef._HasDataType = true; string s = ((string)obj).Trim(); if (s.Length == 0) { builder.SendValidationEvent(SR.Sch_MissDtvalue); } else { XmlSchemaDatatype dtype = XmlSchemaDatatype.FromXdrName(s); if (dtype == null) { builder.SendValidationEvent(SR.Sch_UnknownDtType, s); } builder._ElementDef._ElementDecl.Datatype = dtype; } }
// private static void XDR_BeginGroup(XdrBuilder builder) // { // // } private static void XDR_EndGroup(XdrBuilder builder) { if (!builder._ElementDef._ExistTerminal) { builder.SendValidationEvent(SR.Sch_ElementMissing); } builder._contentValidator.CloseGroup(); if (builder._GroupDef._Order == SchemaOrderMany) { builder._contentValidator.AddStar(); } if (SchemaOrderMany == builder._GroupDef._Order && builder._GroupDef._HasMaxAttr && builder._GroupDef._MaxVal != uint.MaxValue) { builder.SendValidationEvent(SR.Sch_ManyMaxOccurs); } HandleMinMax(builder._contentValidator, builder._GroupDef._MinVal, builder._GroupDef._MaxVal); builder.PopGroupInfo(); }
private static void XDR_EndElementType(XdrBuilder builder) { SchemaElementDecl ed = builder._ElementDef._ElementDecl; // check undefined attribute types first if (builder._UndefinedAttributeTypes != null && builder._ElementDef._AttDefList != null) { DeclBaseInfo patt = builder._UndefinedAttributeTypes; DeclBaseInfo p1 = patt; while (patt != null) { SchemaAttDef pAttdef = null; if (patt._ElementDecl == ed) { XmlQualifiedName pName = patt._TypeName; pAttdef = (SchemaAttDef)builder._ElementDef._AttDefList[pName]; if (pAttdef != null) { patt._Attdef = (SchemaAttDef)pAttdef.Clone(); patt._Attdef.Name = pName; builder.XDR_CheckAttributeDefault(patt, pAttdef); // remove it from _pUndefinedAttributeTypes if (patt == builder._UndefinedAttributeTypes) { patt = builder._UndefinedAttributeTypes = patt._Next; p1 = patt; } else { p1._Next = patt._Next; patt = p1._Next; } } } if (pAttdef == null) { if (patt != builder._UndefinedAttributeTypes) p1 = p1._Next; patt = patt._Next; } } } if (builder._ElementDef._MasterGroupRequired) { // if the content is mixed, there is a group that need to be closed builder._contentValidator.CloseGroup(); if (!builder._ElementDef._ExistTerminal) { if (builder._contentValidator.IsOpen) { builder._ElementDef._ElementDecl.ContentValidator = ContentValidator.Any; builder._contentValidator = null; } else { if (builder._ElementDef._ContentAttr != SchemaContentMixed) builder.SendValidationEvent(SR.Sch_ElementMissing); } } else { if (builder._GroupDef._Order == SchemaOrderMany) { builder._contentValidator.AddStar(); } } } if (ed.Datatype != null) { XmlTokenizedType ttype = ed.Datatype.TokenizedType; if (ttype == XmlTokenizedType.ENUMERATION && !builder._ElementDef._EnumerationRequired) { builder.SendValidationEvent(SR.Sch_MissDtvaluesAttribute); } if (ttype != XmlTokenizedType.ENUMERATION && builder._ElementDef._EnumerationRequired) { builder.SendValidationEvent(SR.Sch_RequireEnumeration); } } CompareMinMaxLength(builder._ElementDef._MinLength, builder._ElementDef._MaxLength, builder); ed.MaxLength = (long)builder._ElementDef._MaxLength; ed.MinLength = (long)builder._ElementDef._MinLength; if (builder._contentValidator != null) { builder._ElementDef._ElementDecl.ContentValidator = builder._contentValidator.Finish(true); builder._contentValidator = null; } builder._ElementDef._ElementDecl = null; builder._ElementDef._AttDefList = null; }
private static uint ParseMinOccurs(object obj, XdrBuilder builder) { uint n = 1; if (!ParseInteger((string) obj, ref n) || ((n != 0) && (n != 1))) { builder.SendValidationEvent("Sch_MinOccursInvalid"); } return n; }