private ValidatingReaderNodeData AddContent(XmlNodeType nodeType)
{
Debug.Assert(_contentIndex <= _contentEvents.Length);
ValidatingReaderNodeData contentInfo = _contentEvents[_contentIndex];
if (contentInfo != null)
{
contentInfo.Clear(nodeType);
_contentIndex++;
return contentInfo;
}
if (_contentIndex >= _contentEvents.Length - 1)
{ //reached capacity of array, Need to increase capacity to twice the initial
ValidatingReaderNodeData[] newContentEvents = new ValidatingReaderNodeData[_contentEvents.Length * 2];
Array.Copy(_contentEvents, 0, newContentEvents, 0, _contentEvents.Length);
_contentEvents = newContentEvents;
}
contentInfo = _contentEvents[_contentIndex];
if (contentInfo == null)
{
contentInfo = new ValidatingReaderNodeData(nodeType);
_contentEvents[_contentIndex] = contentInfo;
}
_contentIndex++;
return contentInfo;
}