private void RegisterEntity(IDtdEntityInfo entity)
{
// check entity recursion
if (_currentEntities != null)
{
if (_currentEntities.ContainsKey(entity))
{
Throw(entity.IsParameterEntity ? SR.Xml_RecursiveParEntity : SR.Xml_RecursiveGenEntity, entity.Name,
_parsingStatesStack[_parsingStatesStackTop].LineNo, _parsingStatesStack[_parsingStatesStackTop].LinePos);
}
}
// save the entity to parsing state & assign it an ID
_ps.entity = entity;
_ps.entityId = _nextEntityId++;
// register entity for recursion checkes
if (entity != null)
{
if (_currentEntities == null)
{
_currentEntities = new Dictionary<IDtdEntityInfo, IDtdEntityInfo>();
}
_currentEntities.Add(entity, entity);
}
}