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 BaseValidator(BaseValidator other) { reader = other.reader; schemaCollection = other.schemaCollection; eventHandling = other.eventHandling; nameTable = other.nameTable; schemaNames = other.schemaNames; positionInfo = other.positionInfo; xmlResolver = other.xmlResolver; baseUri = other.baseUri; elementName = other.elementName; }
public BaseValidator(BaseValidator other) { reader = other.reader; _schemaCollection = other._schemaCollection; _eventHandling = other._eventHandling; _nameTable = other._nameTable; _schemaNames = other._schemaNames; _positionInfo = other._positionInfo; _xmlResolver = other._xmlResolver; _baseUri = other._baseUri; elementName = other.elementName; }
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 BaseValidator(BaseValidator other) { this.reader = other.reader; this.schemaCollection = other.schemaCollection; this.eventHandling = other.eventHandling; this.nameTable = other.nameTable; this.schemaNames = other.schemaNames; this.positionInfo = other.positionInfo; this.xmlResolver = other.xmlResolver; this.baseUri = other.baseUri; this.elementName = other.elementName; }
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); } } }
private void SetupValidation( ValidationType valType ) { validator = BaseValidator.CreateInstance( valType, this, schemaCollection, eventHandling , processIdentityConstraints); XmlResolver resolver = GetResolver(); validator.XmlResolver = resolver; if ( outerReader.BaseURI.Length > 0 ) { validator.BaseUri = ( resolver == null ) ? new Uri( outerReader.BaseURI, UriKind.RelativeOrAbsolute ) : resolver.ResolveUri( null, outerReader.BaseURI ); } coreReaderImpl.ValidationEventHandling = (validationType == ValidationType.None) ? null : eventHandling; }
internal XsdValidator(BaseValidator validator) : base(validator) { Init(); }
internal XdrValidator(BaseValidator validator) : base(validator) { Init(); }
internal XdrValidator(BaseValidator validator) : base(validator) { this.name = XmlQualifiedName.Empty; this.Init(); }
internal XsdValidator(BaseValidator validator) : base(validator) { this.startIDConstraint = -1; this.Init(); }