System.Xml.XmlTextReaderImpl.GetRemainder C# (CSharp) Method

GetRemainder() private method

private GetRemainder ( ) : TextReader
return TextReader
        internal TextReader GetRemainder()
        {
            Debug.Assert(_v1Compat, "XmlTextReaderImpl.GetRemainder cannot be called on reader created via XmlReader.Create.");

            Debug.Assert(_stringBuilder.Length == 0);
            switch (_parsingFunction)
            {
                case ParsingFunction.Eof:
                case ParsingFunction.ReaderClosed:
                    return new StringReader(string.Empty);
                case ParsingFunction.OpenUrl:
                    OpenUrl();
                    break;
                case ParsingFunction.InIncrementalRead:
                    if (!InEntity)
                    {
                        _stringBuilder.Append(_ps.chars, _incReadLeftStartPos, _incReadLeftEndPos - _incReadLeftStartPos);
                    }
                    break;
            }

            while (InEntity)
            {
                HandleEntityEnd(true);
            }

            _ps.appendMode = false;
            do
            {
                _stringBuilder.Append(_ps.chars, _ps.charPos, _ps.charsUsed - _ps.charPos);
                _ps.charPos = _ps.charsUsed;
            } while (ReadData() != 0);

            OnEof();

            string remainer = _stringBuilder.ToString();
            _stringBuilder.Length = 0;
            return new StringReader(remainer);
        }

Usage Example

Example #1
0
 public TextReader GetRemainder()
 {
     return(_impl.GetRemainder());
 }
XmlTextReaderImpl