System.Xml.Schema.BaseValidator.ProcessEntity C# (CSharp) Method

ProcessEntity() protected static method

protected static ProcessEntity ( SchemaInfo sinfo, string name, object sender, ValidationEventHandler eventhandler, string baseUri, int lineNumber, int linePosition ) : void
sinfo SchemaInfo
name string
sender object
eventhandler ValidationEventHandler
baseUri string
lineNumber int
linePosition int
return void
        protected static void ProcessEntity(SchemaInfo sinfo, string name, object sender, ValidationEventHandler  eventhandler, string baseUri, int lineNumber, int linePosition) {
            SchemaEntity en = (SchemaEntity)sinfo.GeneralEntities[new XmlQualifiedName(name)];
            XmlSchemaException e = null;
            if (en == null) {
                // validation error, see xml spec [68]
                e = new XmlSchemaException(Res.Sch_UndeclaredEntity, name, baseUri, lineNumber, linePosition);                    
            }
            else if (en.NData.IsEmpty) {
                e = new XmlSchemaException(Res.Sch_UnparsedEntityRef, name, baseUri, lineNumber, linePosition);
            }
            if (e != null) {
                if (eventhandler != null) {
                    eventhandler(sender, new ValidationEventArgs(e));
                }
                else {
                    throw e;
                }
            }
        }

Usage Example

        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;
            }
        }
All Usage Examples Of System.Xml.Schema.BaseValidator::ProcessEntity