protected static void ProcessEntity(System.Xml.Schema.SchemaInfo sinfo, string name, object sender, ValidationEventHandler eventhandler, string baseUri, int lineNumber, int linePosition) { SchemaEntity entity; XmlSchemaException ex = null; if (!sinfo.GeneralEntities.TryGetValue(new XmlQualifiedName(name), out entity)) { ex = new XmlSchemaException("Sch_UndeclaredEntity", name, baseUri, lineNumber, linePosition); } else if (entity.NData.IsEmpty) { ex = new XmlSchemaException("Sch_UnparsedEntityRef", name, baseUri, lineNumber, linePosition); } if (ex != null) { if (eventhandler == null) { throw ex; } eventhandler(sender, new ValidationEventArgs(ex)); } }
protected static void ProcessEntity(System.Xml.Schema.SchemaInfo sinfo, string name, IValidationEventHandling eventHandling, string baseUriStr, int lineNumber, int linePosition) { SchemaEntity entity; string res = null; if (!sinfo.GeneralEntities.TryGetValue(new XmlQualifiedName(name), out entity)) { res = "Sch_UndeclaredEntity"; } else if (entity.NData.IsEmpty) { res = "Sch_UnparsedEntityRef"; } if (res != null) { XmlSchemaException exception = new XmlSchemaException(res, name, baseUriStr, lineNumber, linePosition); if (eventHandling == null) { throw exception; } eventHandling.SendEvent(exception, XmlSeverityType.Error); } }