private bool ParseRootLevelWhitespace()
{
Debug.Assert(_stringBuilder.Length == 0);
XmlNodeType nodeType = GetWhitespaceType();
if (nodeType == XmlNodeType.None)
{
EatWhitespaces(null);
if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos))
{
return false;
}
}
else
{
_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos);
EatWhitespaces(_stringBuilder);
if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos))
{
if (_stringBuilder.Length > 0)
{
_curNode.SetValueNode(nodeType, _stringBuilder.ToString());
_stringBuilder.Length = 0;
return true;
}
return false;
}
}
if (_xmlCharType.IsCharData(_ps.chars[_ps.charPos]))
{
Throw(SR.Xml_InvalidRootData);
}
else
{
ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos);
}
return false;
}