コード例 #1
0
        // Reads and validated next node from the input data
        public override bool  Read()
        {
            switch (parsingFunction)
            {
            case ParsingFunction.Read:
                if (coreReader.Read())
                {
                    ProcessCoreReaderEvent();
                    return(true);
                }
                else
                {
                    validator.CompleteValidation();
                    return(false);
                }

            case ParsingFunction.ParseDtdFromContext:
                parsingFunction = ParsingFunction.Read;
                ParseDtdFromParserContext();
                goto case ParsingFunction.Read;

            case ParsingFunction.Error:
            case ParsingFunction.ReaderClosed:
                return(false);

            case ParsingFunction.Init:
                parsingFunction = ParsingFunction.Read;     // this changes the value returned by ReadState
                if (coreReader.ReadState == ReadState.Interactive)
                {
                    ProcessCoreReaderEvent();
                    return(true);
                }
                else
                {
                    goto case ParsingFunction.Read;
                }

            case ParsingFunction.ResolveEntityInternally:
                parsingFunction = ParsingFunction.Read;
                ResolveEntityInternally();
                goto case ParsingFunction.Read;

            case ParsingFunction.InReadBinaryContent:
                parsingFunction = ParsingFunction.Read;
                readBinaryHelper.Finish();
                goto case ParsingFunction.Read;

            default:
                Debug.Assert(false);
                return(false);
            }
        }