bool ProcessContent ()
{
switch (reader.NodeType) {
case XmlNodeType.XmlDeclaration:
FillAttributes ();
if (GetAttribute ("standalone") == "yes")
isStandalone = true;
break;
case XmlNodeType.DocumentType:
ReadDoctype ();
break;
case XmlNodeType.Element:
if (constructingTextValue != null) {
currentTextValue = constructingTextValue;
constructingTextValue = null;
if (isWhitespace)
ValidateWhitespaceNode ();
return true;
}
ProcessStartElement ();
break;
case XmlNodeType.EndElement:
if (constructingTextValue != null) {
currentTextValue = constructingTextValue;
constructingTextValue = null;
return true;
}
ProcessEndElement ();
break;
case XmlNodeType.CDATA:
isSignificantWhitespace = isWhitespace = false;
isText = true;
ValidateText ();
if (currentTextValue != null) {
currentTextValue = constructingTextValue;
constructingTextValue = null;
return true;
}
break;
case XmlNodeType.SignificantWhitespace:
if (!isText)
isSignificantWhitespace = true;
isWhitespace = false;
goto case XmlNodeType.DocumentFragment;
case XmlNodeType.Text:
isWhitespace = isSignificantWhitespace = false;
isText = true;
goto case XmlNodeType.DocumentFragment;
case XmlNodeType.DocumentFragment:
// it should not happen, but in case if
// XmlReader really returns it, just ignore.
if (reader.NodeType == XmlNodeType.DocumentFragment)
break;
ValidateText ();
break;
case XmlNodeType.Whitespace:
if (!isText && !isSignificantWhitespace)
isWhitespace = true;
goto case XmlNodeType.DocumentFragment;
}
if (isWhitespace)
ValidateWhitespaceNode ();
currentTextValue = constructingTextValue;
constructingTextValue = null;
return true;
}