protected static ProcessEntity ( |
||
sinfo | ||
name | string | |
sender | object | |
eventhandler | ValidationEventHandler | |
baseUri | string | |
lineNumber | int | |
linePosition | int | |
return | void |
private void ProcessTokenizedType(XmlTokenizedType ttype, string name) { switch (ttype) { case XmlTokenizedType.ID: if (this.FindId(name) == null) { this.AddID(name, base.context.LocalName); return; } base.SendValidationEvent("Sch_DupId", name); return; case XmlTokenizedType.IDREF: if (this.FindId(name) != null) { break; } this.idRefListHead = new IdRefNode(this.idRefListHead, name, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition); return; case XmlTokenizedType.IDREFS: break; case XmlTokenizedType.ENTITY: BaseValidator.ProcessEntity(base.schemaInfo, name, this, base.EventHandler, base.reader.BaseURI, base.PositionInfo.LineNumber, base.PositionInfo.LinePosition); break; default: return; } }
public static void CheckDefaultValue(string value, SchemaAttDef attdef, SchemaInfo sinfo, XmlNamespaceManager nsManager, XmlNameTable NameTable, object sender, ValidationEventHandler eventhandler, string baseUri, int lineNo, int linePos) { try { XmlSchemaDatatype datatype = attdef.Datatype; if (datatype != null) { if (datatype.TokenizedType != XmlTokenizedType.CDATA) { value = value.Trim(); } if (value.Length != 0) { object pVal = datatype.ParseValue(value, NameTable, nsManager); XmlTokenizedType tokenizedType = datatype.TokenizedType; if (tokenizedType == XmlTokenizedType.ENTITY) { if (datatype.Variety == XmlSchemaDatatypeVariety.List) { string[] strArray = (string[])pVal; for (int i = 0; i < strArray.Length; i++) { BaseValidator.ProcessEntity(sinfo, strArray[i], sender, eventhandler, baseUri, lineNo, linePos); } } else { BaseValidator.ProcessEntity(sinfo, (string)pVal, sender, eventhandler, baseUri, lineNo, linePos); } } else if ((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(pVal)) { XmlSchemaException ex = new XmlSchemaException("Sch_EnumerationValue", pVal.ToString(), baseUri, lineNo, linePos); if (eventhandler == null) { throw ex; } eventhandler(sender, new ValidationEventArgs(ex)); } attdef.DefaultValueTyped = pVal; } } } catch { XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString(), baseUri, lineNo, linePos); if (eventhandler == null) { throw exception2; } eventhandler(sender, new ValidationEventArgs(exception2)); } }
public static void CheckDefaultValue(SchemaAttDef attdef, SchemaInfo sinfo, IValidationEventHandling eventHandling, string baseUriStr) { try { if (baseUriStr == null) { baseUriStr = string.Empty; } XmlSchemaDatatype datatype = attdef.Datatype; if (datatype != null) { object defaultValueTyped = attdef.DefaultValueTyped; XmlTokenizedType tokenizedType = datatype.TokenizedType; if (tokenizedType == XmlTokenizedType.ENTITY) { if (datatype.Variety == XmlSchemaDatatypeVariety.List) { string[] strArray = (string[])defaultValueTyped; for (int i = 0; i < strArray.Length; i++) { BaseValidator.ProcessEntity(sinfo, strArray[i], eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition); } } else { BaseValidator.ProcessEntity(sinfo, (string)defaultValueTyped, eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition); } } else if (((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(defaultValueTyped)) && (eventHandling != null)) { XmlSchemaException exception = new XmlSchemaException("Sch_EnumerationValue", defaultValueTyped.ToString(), baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition); eventHandling.SendEvent(exception, XmlSeverityType.Error); } } } catch (Exception) { if (eventHandling != null) { XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString()); eventHandling.SendEvent(exception2, XmlSeverityType.Error); } } }