private int ReadElementContentAsBinary(byte[] buffer, int index, int count)
{
if (count == 0)
{
return 0;
}
int decoded = ReadContentAsBinary(buffer, index, count);
if (decoded > 0)
{
return decoded;
}
// if 0 bytes returned check if we are on a closing EndElement, throw exception if not
if (_curNode.type != XmlNodeType.EndElement)
{
throw new XmlException(SR.Xml_InvalidNodeType, _curNode.type.ToString(), this as IXmlLineInfo);
}
// reset state
_parsingFunction = _nextParsingFunction;
_nextParsingFunction = _nextNextParsingFunction;
Debug.Assert(_parsingFunction != ParsingFunction.InReadElementContentAsBinary);
// move off the EndElement
_outerReader.Read();
return 0;
}