public override bool Read() {
switch ( state ) {
case State.Initial:
useCurNode = false;
state = State.Interactive;
ProcessNamespaces();
return true;
case State.Interactive:
curNsAttr = -1;
useCurNode = false;
reader.MoveToElement();
Debug.Assert( reader.Depth >= initialDepth );
if ( reader.Depth == initialDepth ) {
if ( reader.NodeType == XmlNodeType.EndElement ||
( reader.NodeType == XmlNodeType.Element && reader.IsEmptyElement ) ) {
state = State.EndOfFile;
SetEmptyNode();
return false;
}
Debug.Assert( reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement );
}
if ( reader.Read() ) {
ProcessNamespaces();
return true;
}
else {
SetEmptyNode();
return false;
}
case State.EndOfFile:
case State.Closed:
return false;
case State.PopNamespaceScope:
nsManager.PopScope();
goto case State.ClearNsAttributes;
case State.ClearNsAttributes:
nsAttrCount = 0;
state = State.Interactive;
goto case State.Interactive;
case State.ReadElementContentAsBase64:
case State.ReadElementContentAsBinHex:
if ( !FinishReadElementContentAsBinary() ) {
return false;
}
return Read();
case State.ReadContentAsBase64:
case State.ReadContentAsBinHex:
if ( !FinishReadContentAsBinary() ) {
return false;
}
return Read();
default:
Debug.Assert( false );
return false;
}
}